// components/l-overlay/index.js Component({ attached () { this._init(); }, pageLifetimes: { show () { this._init() } }, properties: { }, /** * 组件的初始数据 */ data: { hide: false }, /** * 组件的方法列表 */ methods: { // 定义调用组件的js方法 _init () { wx.lxd = wx.lxd || {}, wx.lxd.Overlay = e => { // tabber this.setData({ // app.js 固定定义 // 页面传参 ...e, }) } wx.lxd = wx.lxd || {}, wx.lxd.HideOverlay = () => { this.setData({ show: false }) } }, // 隐藏函数 hidefunc () { this.setData({ show: false }) } } })