yuminge-app/yun-min-program-plugin-master/packageG/mycomponent/backup/backup.js

57 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// packageE/backup/backup.js
Component({
properties: {
datas: {
type: null,
},
component_id: {
type: null,
},
},
// 私有数据,可用于模板渲染
data: {
emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/backtotop@2x.png",
clientWidth: "375",
},
lifetimes: {
// 生命周期函数可以为函数或一个在methods段中定义的方法名
attached() {},
moved() {},
detached() {},
},
// 生命周期函数可以为函数或一个在methods段中定义的方法名
attached() {},
// 此处attached的声明会被lifetimes字段中的声明覆盖
ready() {
this.setData({
clientWidth: wx.getSystemInfoSync().windowWidth,
});
},
pageLifetimes: {
// 组件所在页面的生命周期函数
show() {},
hide() {},
resize() {},
},
methods: {
//回到顶部
backup: function (e) {
// 一键回到顶部
if (wx.pageScrollTo) {
wx.pageScrollTo({
scrollTop: 0,
});
} else {
wx.showModal({
title: "提示",
content:
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。",
});
}
},
},
});