Search.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div>
  3. <button class="button button_icon" @click="$modal.show('search-modal')">
  4. <span class="button__icon"> <BaseIcon :name="'search'" clear /></span>
  5. </button>
  6. <modal name="search-modal" adaptive>
  7. <div class="search_modal">
  8. <h2>Поиск</h2>
  9. <BaseInput v-model="string" @keyupEnter="goToSearch"></BaseInput>
  10. <button
  11. class="catalog-main__subscribe button button_grey-dark button_grey-dark-short"
  12. @click="goToSearch"
  13. >
  14. Найти
  15. </button>
  16. </div>
  17. </modal>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. string: "",
  25. searchList: [],
  26. };
  27. },
  28. methods: {
  29. goToSearch() {
  30. this.$modal.hide("search-modal");
  31. this.$router.push({
  32. name: "search",
  33. params: {
  34. query: this.string,
  35. },
  36. });
  37. },
  38. },
  39. };
  40. </script>
  41. <style lang="less">
  42. input[type="text"] {
  43. width: 100%;
  44. display: block;
  45. max-width: 350px;
  46. padding: 0;
  47. line-height: 1;
  48. border: none;
  49. border-radius: 0;
  50. background: #fff;
  51. -webkit-appearance: none;
  52. -moz-appearance: none;
  53. appearance: none;
  54. outline: 0;
  55. color: #000;
  56. height: 44px;
  57. padding: 0 15px;
  58. font-size: 18px;
  59. border: 1px solid #ebebeb;
  60. }
  61. .search_modal {
  62. display: flex;
  63. justify-content: space-evenly;
  64. align-items: center;
  65. padding: 20px;
  66. @media (max-width: 576px) {
  67. align-items: flex-start;
  68. flex-direction: column;
  69. input,
  70. button {
  71. margin: 10px 0;
  72. }
  73. }
  74. }
  75. </style>