index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div class="container">
  3. <recommend-product/>
  4. <commodity-list :kinds="kinds"/>
  5. </div>
  6. </template>
  7. <script>
  8. import axios from '~plugins/axios'
  9. import { CommodityList, RecommendProduct } from '~components/store'
  10. export default {
  11. layout: 'shop',
  12. data () {
  13. return {
  14. uuid: this.$route.params.uuid
  15. }
  16. },
  17. fetch ({ store, params }) {
  18. return Promise.all([
  19. store.dispatch('shop/findStoreInfoFromUuid', params),
  20. store.dispatch('shop/findRecommendProducts', params),
  21. store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
  22. ])
  23. },
  24. async asyncData ({ params }) {
  25. // asyncData ({ params }) {
  26. let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  27. // axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
  28. // .then(response => {
  29. return { kinds: data }
  30. // })
  31. },
  32. components: {
  33. RecommendProduct,
  34. CommodityList
  35. }
  36. }
  37. </script>
  38. <style>
  39. #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
  40. width: 320px !important;
  41. }
  42. #nav_fragment .el-dialog__wrapper .el-dialog__body{
  43. padding: 14px !important;
  44. }
  45. </style>