拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 878B

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // components/ImageList/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. imageSource: {
  8. type: String,
  9. value: ''
  10. },
  11. limit: {
  12. type: Number,
  13. value: 3
  14. }
  15. },
  16. /**
  17. * 组件的初始数据
  18. */
  19. data: {
  20. imageList: []
  21. },
  22. observers: {
  23. 'imageSource'(imageSource) {
  24. if(imageSource.length) {
  25. const images = imageSource.split(',')
  26. if(images.length > this.properties.limit) {
  27. const imageList = images.slice(0, this.properties.limit)
  28. this.setData({imageList})
  29. } else {
  30. this.setData({imageList: images})
  31. }
  32. }
  33. }
  34. },
  35. /**
  36. * 组件的方法列表
  37. */
  38. methods: {
  39. }
  40. })