Component({ attached () { this._init(); }, pageLifetimes: { show () { this._init() } }, properties: { }, /** * 组件的初始数据 */ data: { durations: { enter: 300, leave: 1000 }, time: 3000, }, /** * 组件的方法列表 */ methods: { // 定义调用组件的js方法 _init () { wx.lxd = wx.lxd || {}, wx.lxd.Notify = e => { e.show = true; console.warn(e) this.setData({ ...e }) if (!!e.show) { const time = setTimeout(() => { this.setData({ show: false }) clearTimeout(time) }, this.data.time) } } }, } })