_keyword.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div class="container" id="searchResult">
  3. <search-title :keyword="key" @showAction="showAction" @typeAction="onTypeChanged"></search-title>
  4. <store-content v-show="show" @pageAction="onPageChanged"></store-content>
  5. </div>
  6. </template>
  7. <script>
  8. import { SearchTitle, StoreContent } from '~components/searchStore'
  9. export default {
  10. layout: 'main',
  11. components: {
  12. SearchTitle,
  13. StoreContent
  14. },
  15. data () {
  16. return {
  17. key: this.$route.query.w,
  18. show: true,
  19. type: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY'
  20. }
  21. },
  22. fetch ({store, route}) {
  23. return Promise.all([
  24. store.dispatch('searchStore/searchStoreDetail', {page: 1, count: 8, keyword: route.query.w, types: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY', op: 'pageByType'})
  25. ])
  26. },
  27. methods: {
  28. showAction: function (show) {
  29. this.show = show
  30. },
  31. onPageChanged: function (page) {
  32. this.$store.dispatch('searchStore/searchStoreDetail', {page: page, count: 8, keyword: this.$route.query.w, types: this.type, op: 'pageByType'})
  33. },
  34. onTypeChanged: function (type) {
  35. this.type = type
  36. }
  37. }
  38. }
  39. </script>