X中只能单独推导了

有问
- 发布:2025-08-17 21:20
- 更新:2025-08-18 11:50
- 阅读:75
有问 (作者)
mixin.ts
export const mixin= {
domain:"test",
getCurrDatetime:((full:Boolean){
return "ssss"
})
}
然后在man.uts中
import {mixin} from ....
app.config.globalProperties.$mixin=mixin as UTSJSONObject;//混入
index.uvue
使用setup
proxy=getCurrentInstance()?.proxy;
const mixin=ref<UTSJSONObject>(proxy?.$mixin as UTSJSONObject)
在onShow中,测试延迟输出
console.log(mixin.value?.domain) //这个输出成功为test
但mixin.value?.getCurrDatetime(false) 这个方法就一直提示:error: Unresolved reference: getCurrDatetime
2025-08-18 12:27