官方配置> https://uniapp.dcloud.net.cn/tutorial/typescript-subject.html
项目配置
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
onLaunch: function():void {
console.log('App Launch')
},
onShow: function():void {
console.log('App Show')
},
onHide: function():void {
console.log('App Hide')
}
})
</script>
02:29:35.265 [tsl] ERROR at App.vue:4
02:29:35.267 TS2769:No overload matches this call.
02:29:35.276 The last overload gave the following error.
02:29:35.277 Argument of type '{ onLaunch: () => void; onShow: () => void; onHide: () => void; }' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'.
02:29:35.287 Object literal may only specify known properties, and 'onLaunch' does not exist in type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'.
0 个回复