<!-- 分享按钮 -->
<button
class="share-btn"
open-type="share"
hover-class="share-btn-hover"
点击分享当前页面
</button>
<script>
export default {
onShareAppMessage:function() {
// 获取 <script setup> 中定义的当前页面完整路径(含参数)
// const currentPageFullPath = this.$options.setup().getCurrentPageFullPath();
return {
// 自定义分享标题
title: '这是带参数的页面分享(含ID等信22222355555555522息)',
// 核心:分享跳转路径(携带当前页面参数,他人点击后会携带该参数进入)
path: '/pages/index/123/123?id=' + 123 ,
// 自定义分享图片(本地静态图片,无域名问题,优先推荐)
imageUrl: '/static/share-custom.png',
// 分享回调
success: () => {
uni.showToast({ title: '分享成功', icon: 'success', duration: 1500 });
},
fail: () => {
uni.showToast({ title: '您取消了分享', icon: 'none', duration: 1500 });
}
};
},
</script>
点击没反应,一直报下面这样的错误。这是什么原因