Component({ properties: { // 这里定义了innerText属性,属性值可以在组件使用时指定 object:{ type:Object, value:null }, }, data: { // 这里是一些组件内部数据 yc:false, btn: 1, ad:false, autoplay:false, interval:5000, 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 }); } } })