You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pifa/core/mixins/wxofficial.js

51 lines
1.1 KiB

5 months ago
import { isWeixinOfficial } from '@/core/platform'
import WxofficialSettingModel from '@/common/model/wxofficial/Setting'
export default {
data() {
return {
// 微信公众号链接分享卡片内容
wxofficialShareData: undefined
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onShow() {
// 设置微信公众号链接分享卡片内容
if (isWeixinOfficial && this.wxofficialShareData) {
WxofficialSettingModel.updateShareData(this.wxofficialShareData)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
// 将微信分享卡片内容还原
isWeixinOfficial && WxofficialSettingModel.setGlobalShareCard(true)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
// 将微信分享卡片内容还原
isWeixinOfficial && WxofficialSettingModel.setGlobalShareCard(true)
},
methods: {
// 更新分享卡片内容
updateShareCardData(param) {
if (isWeixinOfficial) {
this.wxofficialShareData = param
WxofficialSettingModel.updateShareData(this.wxofficialShareData)
}
}
},
}