diy_advertising.js
865 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
39
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
object:{
type:Object,
value:null
},
},
data: {
// 这里是一些组件内部数据
yc:false,
btn: 1,
ad:false,
autoplay:true,
interval:3000,
duration:1000,
someData: {},
max_sw_height:null,
},
methods: {
customMethod: function () { },
//---智能跳转---
go_url:function(e){
var url=e.currentTarget.dataset.url;
getApp().goto(url);
},
imageLoad:function(e){
var imgwidth = e.detail.width;
var imgheight = e.detail.height;
//宽高比
var ratio = imgwidth / imgheight;
//计算的高度值
var viewHeight = 715 / ratio;
if (this.data.max_sw_height < viewHeight) this.setData({ max_sw_height: viewHeight });
}
}
})