Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <div class="m-select">
  2. <div class="m-select__search">
  3. <span class="search__dropdown-ico">
  4. <i class="fa fa-sort-desc"></i>
  5. </span>
  6. <input type="text"
  7. name=""
  8. placeholder="город"
  9. @focus="onFocus()"
  10. @blur="onBlur()">
  11. </div>
  12. <div v-if="isVisibleDropdown" class="m-select__dropdown-list">
  13. <ul>
  14. <li v-for="city in cities">
  15. <span @click="selectItem(city.name)">
  16. {{ city.name }}
  17. </span>
  18. </li>
  19. </ul>
  20. </div>
  21. </div>
  22.  
  23. export default {
  24. data() {
  25. return {
  26. isVisibleDropdown: true,
  27. cities: [
  28. {
  29. name: 'Москва'
  30. },
  31. {
  32. name: 'Самара'
  33. },
  34. {
  35. name: 'Казань'
  36. }
  37. ]
  38. }
  39. },
  40. methods: {
  41. onFocus() {
  42. this.isVisibleDropdown = true
  43. },
  44. onBlur() {
  45. this.isVisibleDropdown = false
  46. },
  47. selectItem(name) {
  48. alert(name)
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement