8
问题描述 使用了app.mixin(GlobalShare)进行分享设置; 会导致setup scirpt语法使用onShareAppMessage不生效
复现步骤 main.js 全局入口添加了
export const GlobalShare = {
onShareAppMessage() {
return {
title: SHARE_DEFAULT_INFO.title,
path: SHARE_DEFAULT_INFO.path,
imageUrl: SHARE_DEFAULT_INFO.imageUrl,
success() {
uni.showToast({
title: "分享成功",
});
},
fail() {
uni.showToast({
title: "分享失败",
icon: "none",
});
},
};
},
};
export function createApp() {
const app = createSSRApp(App);
app.use(Store);
app.mixin(GlobalShare);
return {
app,
};
}
页面自定义 不生效
<script lang="ts" setup>
import { onShareAppMessage } from "@dcloudio/uni-app";
onShareAppMessage(() => {
return {
title: "自定义分享标题",
path: "/pages/home/index",
};
});
</script>
系统信息:
- 发行平台: 微信小程序
- uni-app版本 3.0.0-alpha-3040820220424001