我的手机是iPhone X,iOS 14.6,微信8.0.7,在小程序中设置了分享到朋友圈,运行时没有显示分享到朋友圈和收藏按钮。同事A的iPhone 7,iOS 13.6.1,微信8.0.7,同事B的华为Mate 40 Pro,已升级鸿蒙2(原来是安卓10),微信8.0.6,都能正常显示。
代码如下
// ShareData.js
export default {
data() {
return {
shareData:{
title: 'Title here',
path: "", // onShareAppMessage用
query: "", // onShareTimeline用
imageUrl: '',
enabled: true
}
}
},
watch: {
shareData: {
handler(value) {
const OBJECT = {
menus: ['shareAppMessage', 'shareTimeline'],
fail: (res) => {
console.log(JSON.stringify(res))
}
};
if (value.enabled) uni.showShareMenu(OBJECT)
else uni.hideShareMenu(OBJECT);
},
deep: true
}
},
onShareAppMessage(res) { //发送给朋友
return {
title: this.shareData.title,
path: this.shareData.path,
imageUrl: this.shareData.imageUrl
}
},
onShareTimeline(res) {//分享到朋友圈
return {
title: this.shareData.title,
query: this.shareData.query,
imageUrl: this.shareData.imageUrl,
}
}
}
<template>
<view>代码略</view>
</template>
<script>
import ShareData from '@/script/share/ShareData.js'
export default {
mixins: [ShareData],
data() {
return {
}
}
// 其它代码略
}
</script>
请遇到过类似的兄弟们指点一下这是咋回事?