63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
// packageE/headline/headline.js
|
||
Component({
|
||
properties: {
|
||
datas: {
|
||
type: null,
|
||
},
|
||
component_id: {
|
||
type: null,
|
||
},
|
||
},
|
||
// 私有数据,可用于模板渲染
|
||
data: {
|
||
data_2: [],
|
||
emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/toutiao.png",
|
||
clientWidth: "375",
|
||
images: {},
|
||
},
|
||
|
||
lifetimes: {
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {},
|
||
moved() {},
|
||
detached() {},
|
||
},
|
||
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {},
|
||
// 此处attached的声明会被lifetimes字段中的声明覆盖
|
||
ready() {
|
||
this.setData({
|
||
clientWidth: wx.getSystemInfoSync().windowWidth,
|
||
});
|
||
},
|
||
|
||
pageLifetimes: {
|
||
// 组件所在页面的生命周期函数
|
||
show() {},
|
||
hide() {},
|
||
resize() {},
|
||
},
|
||
methods: {
|
||
imageLoad: function (e) {
|
||
var $width = e.detail.width, //获取图片真实宽度
|
||
$height = e.detail.height,
|
||
ratio=$width/$height; //图片的真实宽高比例
|
||
let image = {
|
||
width: $width,
|
||
height: $height,
|
||
ratio: ratio
|
||
};
|
||
this.setData({
|
||
images: image
|
||
});
|
||
},
|
||
gotoList() {
|
||
wx.setStorageSync("headline", this.data.datas.list);
|
||
wx.navigateTo({
|
||
url: "/packageA/member/article/ArticleList/ArticleList",
|
||
});
|
||
},
|
||
},
|
||
});
|