37 lines
553 B
TypeScript
37 lines
553 B
TypeScript
// components/fileBox/fileBox.ts
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
imgs: {
|
|
type: Array,
|
|
value: []
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
index: 0
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
preview() {
|
|
let temps: { url: any }[] = []
|
|
this.data.imgs.map((item: any) => {
|
|
console.log(item);
|
|
|
|
temps.push({
|
|
url: item,
|
|
})
|
|
})
|
|
wx.previewMedia({ sources: temps, current: this.data.index })
|
|
}
|
|
}
|
|
})
|