// 禁用分享(請求后臺介面獲取appid,簽名,時間戳等資料)
getJSSDK () {
const that = this
const url = api.getJSSDK
const routerPath = window.location.href.split('#')[0]
console.log(routerPath, 'routerPath')
that.$POST(url, { url: routerPath }, res => {
console.log(res, 'getJSSDK')
if (res.errorCode === 0) {
if (res.body) {
window.wx.config({
debug: false,
appId: res.body.appId,
timestamp: res.body.timestamp,
nonceStr: res.body.nonceStr,
signature: res.body.signature,
jsApiList: ['hideMenuItems'],
success: function (res) {
alert('成功')
console.log(res, '成功')
},
fail: function (res) {
alert('失敗失敗')
console.log(res, '失敗')
},
complete: function (res) {
alert('complete')
console.log(res, '777777777777')
}
})
window.wx.ready(function () {
console.log('禁止分享')
window.wx.hideMenuItems({ // 要隱藏的選單項,只能隱藏“傳播類”和“保護類”按鈕,所有menu項見附錄3
menuList: ['menuItem:share:appMessage', 'menuItem:share:timeline', 'menuItem:share:timeline', 'menuItem:share:qq', 'menuItem:favorite', 'menuItem:share:QZone', 'menuItem:openWithSafari', 'menuItem:copyUrl', 'menuItem:share:email']
})
})
}
}
})
},
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/145363.html
標籤:其他
