|
- // components/ImageList/index.js
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- imageSource: {
- type: String,
- value: ''
- },
- limit: {
- type: Number,
- value: 3
- }
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- imageList: []
- },
-
- observers: {
- 'imageSource'(imageSource) {
- if(imageSource.length) {
- const images = imageSource.split(',')
- if(images.length > this.properties.limit) {
- const imageList = images.slice(0, this.properties.limit)
- this.setData({imageList})
- } else {
- this.setData({imageList: images})
- }
- }
- }
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
-
- }
- })
|