mixin.js 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import api from '../../config/api'
  2. import {funMixin} from '../../config/mixin'
  3. export const commonMixin = {
  4. name: 'headerComponent',
  5. mixins: [funMixin],
  6. props: {
  7. terminal: {
  8. type: Number,
  9. default: 4
  10. },
  11. typeId: {
  12. type: Number,
  13. default: 1
  14. },
  15. shopId: {
  16. type: Number,
  17. default: 0
  18. },
  19. componentContent: {
  20. type: Object
  21. }
  22. },
  23. data () {
  24. return {
  25. classifyData: []
  26. }
  27. },
  28. mounted() {
  29. this.getData()
  30. },
  31. methods: {
  32. getData() {
  33. this.beforeGetData()
  34. const _ = this
  35. _.sendReq({
  36. url: `${api.getClassify}?page=1&pageSize=20`,
  37. method: 'GET'
  38. }, (res) => {
  39. _.afterGetData()
  40. _.classifyData = res.data
  41. console.log(_.classifyData)
  42. },(err)=>{
  43. _.afterGetData()
  44. })
  45. }
  46. }
  47. }