Property 'unmount' does not exist on type 'App<Element>'
来源:8-7 Message 组件改进为函数调用形式
Oyxiaoxi
2021-03-08
setTimeOut(() => {
messageInstance.unmount(mountNode)
document.body.removeChild(mountNode)
}, timeout)
写回答
1回答
-
张轩
2021-03-08
同学你好 组件实例上应该是有这个方法的 你选择 messageInstance 点击右键 选择第二个 go to type difinition 去看一下。我的是这样的。是能看到 unmount 方法的
export declare interface App<HostElement = any> { version: string; config: AppConfig; use(plugin: Plugin_2, ...options: any[]): this; mixin(mixin: ComponentOptions): this; component(name: string): Component | undefined; component(name: string, component: Component): this; directive(name: string): Directive | undefined; directive(name: string, directive: Directive): this; mount(rootContainer: HostElement | string, isHydrate?: boolean): ComponentPublicInstance; unmount(rootContainer: HostElement | string): void; provide<T>(key: InjectionKey<T> | string, value: T): this; _uid: number; _component: ConcreteComponent; _props: Data | null; _container: HostElement | null; _context: AppContext; }
不知道你的是怎样的,如果完全不一样,说明你的类型定义文件有可能有问题,你可以尝试重装一次 vue试试。
022021-03-08
相似问题
请问老师关于unmount参数
回答 2