index.js 846 B

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