// component/authorize/authorize.js import utils from '../../utils/util.js' Component({ /** * 组件的属性列表 */ properties: {}, /** * 组件的初始数据 */ data: { isAuthorize: true, }, lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { }, moved() { }, detached() { }, ready() { } }, pageLifetimes: { // 组件所在页面的生命周期函数 show() { utils.isAuthorize(this); }, hide() { }, }, /** * 组件的方法列表 */ methods: { preventMove: function () { // 利用catchtouchmove阻止背景滚动 不用添加任何代码 // 只适合模态层不需要滚动的场景 }, // 点击授权 getUserInfo: function (e) { utils.authorize(e, this, () => { console.log('提交授权后的回调函数'); }) }, } })