index.js 849 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import behavior from '~/mixins/video'
  2. Component({
  3. behaviors: [behavior],
  4. properties: {
  5. worksList: {
  6. type: Array,
  7. value: [],
  8. observer(newVal) {
  9. this.setData({
  10. worksListCopy: newVal
  11. })
  12. }
  13. },
  14. videoType: {
  15. type: String,
  16. // value 为public时是默认公共样式,为my时为“我的”样式,展示下载删除是否公开,pk为pk的样式文案,collection为收藏时的样式
  17. value: 'public'
  18. },
  19. },
  20. data: {
  21. worksListCopy: {}
  22. },
  23. methods: {
  24. setListFans({
  25. detail
  26. }) {
  27. let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
  28. worksListCopy.forEach(item => {
  29. if (item.user.uid == detail) {
  30. item.isFans = true
  31. }
  32. })
  33. this.setData({
  34. worksListCopy
  35. })
  36. }
  37. },
  38. })