_id.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div class="container">
  3. <categroy-nav></categroy-nav>
  4. <category-property @loadCmpGoodsByBrandEvent="listemBrandFilter"></category-property>
  5. <component-goods></component-goods>
  6. </div>
  7. </template>
  8. <script>
  9. import { CategroyNav, CategoryProperty, ComponentGoods } from '~components/product'
  10. export default {
  11. layout: 'main',
  12. fetch ({store, route}) {
  13. return Promise.all([
  14. store.dispatch('product/loadKindParentsWithBothers', {id: route.params.id}),
  15. store.dispatch('product/loadKindBrands', {id: route.params.id}),
  16. store.dispatch('product/pageComGoods', {kindid: route.params.id})
  17. ])
  18. },
  19. components: {
  20. CategroyNav,
  21. CategoryProperty,
  22. ComponentGoods
  23. },
  24. methods: {
  25. loadPage (id) {
  26. this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: id})
  27. },
  28. listemBrandFilter (brandid) {
  29. if (brandid) {
  30. this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid})
  31. } else {
  32. this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id})
  33. }
  34. }
  35. }
  36. }
  37. </script>
  38. <style>
  39. .container {
  40. position: relative;
  41. width: 1190px;
  42. margin-right: auto;
  43. margin-left: auto;
  44. }
  45. </style>