index.js 771 B

12345678910111213141516171819202122232425262728293031323334
  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. },
  15. data: {
  16. worksListCopy: {}
  17. },
  18. methods: {
  19. setListFans({
  20. detail
  21. }) {
  22. let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
  23. worksListCopy.forEach(item => {
  24. if (item.user.uid == detail) {
  25. item.isFans = true
  26. }
  27. })
  28. this.setData({
  29. worksListCopy
  30. })
  31. }
  32. },
  33. })