以 index.uvue 模板绑定为例(SelectionPopover 自定义组件,8 个事件中 shareImage 为其一):
-
状态A(能跑,控制台报错):
<SelectionPopover ... @share-image="onCardShareImage" />
// script:onCardShareImage 仅在 #ifdef MP-WEIXIN 内定义 -
状态B(崩溃):将定义移出条件编译(全平台定义,真函数/空函数/null 均崩):
const cardShareImage = ref('')
function onCardShareImage(path : string) : void {
cardShareImage.value = path
} -
状态C(崩溃):模板侧包裹 <!-- #ifdef MP-WEIXIN --> @share-image="onCardShareImage" <!-- #endif -->,
编译产物(www/assets/pages/index/index.js)已确认不含 onShareImage 槽位,仍崩。
0 个回复