报错
类型“{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<{} & {} & {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 4 more ... & ComponentC...”上不存在属性“xxxxx”。时
在src文件下创建shims-vue.d.ts 文件
export {}
declare module 'vue' {
interface ComponentCustomProperties {
$filters: any
}
}
注意:一定要添加export {} 不然会覆盖掉原来的