index.js
881 Bytes
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
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
data: {
style: ''
},
methods: {
_dataChange() {
let that = this;
let floorData = this.data.floorData;
let width = floorData.image_width;
let height = floorData.image_height;
tt.getSystemInfo({
success: function(res) {
let windowWidth = res.screenWidth;
windowWidth = floorData.is_extend == 1 ? windowWidth : windowWidth - 30;
let realHeight = windowWidth * height / width;
let style = `margin: 0 ${floorData.is_extend == 1 ? 0 : 15}px; height:${realHeight}px`;
that.setData({
style
})
}
})
}
}
});