ai-c/pages/webview/webview.js
2026-02-02 18:21:32 +08:00

35 lines
829 B
JavaScript

// Webview 页面
Page({
data: {
webUrl: '',
title: ''
},
onLoad(options) {
if (options.url) {
this.setData({
webUrl: decodeURIComponent(options.url)
})
}
if (options.title) {
wx.setNavigationBarTitle({
title: decodeURIComponent(options.title)
})
this.setData({ title: decodeURIComponent(options.title) })
}
},
goBack() {
wx.navigateBack()
},
onShareAppMessage() {
const referralCode = wx.getStorageSync('referralCode') || ''
const referralCodeParam = referralCode ? `&referralCode=${referralCode}` : ''
return {
title: this.data.title || '关于品牌',
path: `/pages/webview/webview?url=${encodeURIComponent(this.data.webUrl)}&title=${encodeURIComponent(this.data.title || '')}${referralCodeParam}`
}
}
})