diy_picMax.js
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Component({
properties: {
object: {
type: Object,
value: null
},
// 这里定义了innerText属性,属性值可以在组件使用时指定
},
data: {
// 这里是一些组件内部数据
someData: {},
pic_height: 0,//图片组合的高度
is_yspan: 0, //是否要严格按照比例来实现
},
ready: function () {
//-- console.log(this.data.object.data) --
//-- 计算图片组合占用的高度 --
var height = 0;
var is_yspan = 0;
this.properties.object.data.forEach(function (val, ind) {
if (val.fir.x == 0) {
height += val.y_span * 187;
}
if (val.y_span > 1) is_yspan = 1;
})
this.setData({ pic_height: height, is_yspan: is_yspan })
},
methods: {
//-- 智能跳转到页面 --
gopage(e) {
var url = e.currentTarget.dataset.url;
getApp().goto(url);
},
previewImage(e){
let src =e.currentTarget.dataset.src;
wx.previewImage({
current: src, // 当前显示图片的http链接
urls: [src] ,// 需要预览的图片http链接列表
});
}
}
})