const TITLES = { privacy: '隐私政策', agreement: '用户协议' }; Page({ data: { type: 'privacy', title: '隐私政策' }, onLoad(options) { const type = options.type || 'privacy'; const title = TITLES[type] || '隐私政策'; this.setData({ type, title }); wx.setNavigationBarTitle({ title }); }, // ---- 分享 ---- onShareAppMessage() { const title = this.data.title || '明缘云道场'; return { title, path: '/pages/privacy/privacy?type=' + this.data.type }; }, onShareTimeline() { return { title: this.data.title || '明缘云道场', query: 'type=' + this.data.type }; } });