html
<view>
<web-view src="{{ redirectUrl }}"></web-view>
</view>
js
Page({
data: {
redirectUrl: '',
title: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
_this.setData({
redirectUrl: options.redirectUrl,
title: options.title
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
wx.setNavigationBarTitle({
title: this.data.title
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (options) {
const _this = this;
let share = {
title: `分享文章`,
path: '/pages/web-view/h5/index?redirectUrl=' + this.data.redirectUrl + '&title=' + this.data.title
};
return share;
}
})
网友评论