mr_*_*ing 5 extend typescript vue.js vuejs2 vuejs3
我有一个组件
const DialogMain = Vue.extend(DialogComponent);
export const alertDialog = (text: string) => {
const dialog = new DialogMain({
propsData: {
type: 'alert'
},
});
return new Promise(resolve => {
// resolve reject handle here
}
});
Run Code Online (Sandbox Code Playgroud)
因此,当我将应用程序迁移到 Vue3 时,出现'extend' does not exist on type 'typeof import('....')错误。我知道,由于全局 Vue 不再是可新建的构造函数,因此Vue.extend在构造函数扩展方面不再有意义。但我不知道如何用defineComponent编写它。是不是应该像
const dialogMain = defineComponent({extends: DialogComponent})
Run Code Online (Sandbox Code Playgroud)
会和一样吗Vue.extend?
您是否尝试过按原样使用组件选项?
const DialogMain = defineComponent(DialogComponent)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1483 次 |
| 最近记录: |