带有Vetur的VSCode中具有Typescript的NativeScript-Vue:类型为“ void”的警报,然后给出属性'then'不存在

问题描述 投票:0回答:1

我在Vetur中使用VSCode。这是我的代码:

alert({
  title: 'Success!',
  message: 'Account created successfully',
  okButtonText: 'Okay'
  }).then(() => {
  console.log('Alert dialog closed!');
})

我收到错误Property 'then' does not exist on type 'void' Vetur(2339)

我只是按照此处的文档中的说明进行操作:https://nativescript-vue.org/en/docs/elements/dialogs/alert/

知道发生了什么吗?

typescript visual-studio-code nativescript nativescript-vue vetur
1个回答
0
投票

请确保

import { alert } from 'tns-core-modules/ui/dialogs
© www.soinside.com 2019 - 2024. All rights reserved.