Search.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!--http://shipow.github.io/searchbox/-->
  2. <template>
  3. <div class="">
  4. <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
  5. <symbol xmlns="http://www.w3.org/2000/svg" id="sbx-icon-search-11" viewBox="0 0 40 40">
  6. <path d="M15.553 31.106c8.59 0 15.553-6.963 15.553-15.553S24.143 0 15.553 0 0 6.963 0 15.553s6.963 15.553 15.553 15.553zm0-3.888c6.443 0 11.665-5.222 11.665-11.665 0-6.442-5.222-11.665-11.665-11.665-6.442 0-11.665 5.223-11.665 11.665 0 6.443 5.223 11.665 11.665 11.665zM27.76 31.06c-.78-.78-.778-2.05.004-2.833l.463-.463c.783-.783 2.057-.78 2.834-.003l8.168 8.17c.782.78.78 2.05-.003 2.832l-.463.463c-.783.783-2.057.78-2.833.003l-8.17-8.167z"
  7. fill-rule="evenodd" />
  8. </symbol>
  9. <symbol xmlns="http://www.w3.org/2000/svg" id="sbx-icon-clear-2" viewBox="0 0 20 20">
  10. <path d="M8.96 10L.52 1.562 0 1.042 1.04 0l.522.52L10 8.96 18.438.52l.52-.52L20 1.04l-.52.522L11.04 10l8.44 8.438.52.52L18.96 20l-.522-.52L10 11.04l-8.438 8.44-.52.52L0 18.96l.52-.522L8.96 10z" fill-rule="evenodd" />
  11. </symbol>
  12. </svg>
  13. <form novalidate="novalidate" onsubmit="return false;" class="searchbox sbx-amazon">
  14. <div role="search" class="sbx-amazon__wrapper">
  15. <input
  16. v-model="query"
  17. type="search"
  18. name="search"
  19. placeholder="Search your Product"
  20. autocomplete="off"
  21. required="required"
  22. class="sbx-amazon__input">
  23. <button
  24. @click="onSearch"
  25. type="submit"
  26. title="Submit your search query."
  27. class="sbx-amazon__submit"
  28. >
  29. <svg role="img" aria-label="Search">
  30. <use xlink:href="#sbx-icon-search-11"></use>
  31. </svg>
  32. </button>
  33. <button type="reset" title="Clear the search query." class="sbx-amazon__reset">
  34. <svg role="img" aria-label="Reset">
  35. <use xlink:href="#sbx-icon-clear-2"></use>
  36. </svg>
  37. </button>
  38. </div>
  39. </form>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. data () {
  45. return {
  46. query: ''
  47. }
  48. },
  49. methods: {
  50. onSearch () {
  51. this.$router.push({
  52. path: '/search',
  53. query: {
  54. title: this.query
  55. }
  56. })
  57. }
  58. }
  59. }
  60. </script>