mixin.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
  2. // import 'swiper/css/swiper.css'
  3. import api from '../../config/api'
  4. import {funMixin} from '../../config/mixin'
  5. export const commonMixin = {
  6. name: 'productList',
  7. mixins: [funMixin],
  8. props: {
  9. terminal: {
  10. type: Number,
  11. default: 4
  12. },
  13. typeId: {
  14. type: Number,
  15. default: 1
  16. },
  17. shopId: {
  18. type: Number,
  19. default: 0
  20. },
  21. componentContent: {
  22. type: Object
  23. }
  24. },
  25. // components: {
  26. // Swiper,
  27. // SwiperSlide
  28. // },
  29. // directives: {
  30. // swiper: directive
  31. // },
  32. data () {
  33. return {
  34. productData: []
  35. }
  36. },
  37. watch: {
  38. 'componentContent': {
  39. handler(newVal, oldVal) {
  40. this.getData()
  41. },
  42. deep: true
  43. }
  44. },
  45. created() {
  46. this.getData()
  47. },
  48. methods: {
  49. getData() {
  50. const _ = this
  51. _.sendReq({
  52. url: `${api.getMemberProducts}?page=1&pageSize=20`,
  53. method: 'GET'
  54. }, (proRes) => {
  55. _.productData = proRes.data.list
  56. })
  57. }
  58. }
  59. }