全局属性引入方式的改变
- 参考vue官方扩展全局属性
- Vue - Official的 全局声明方式如下:
declare module "vue" {
interface ComponentCustomProperties {
ElButton: (typeof import("element-plus"))["ElButton"];
}
}
批量导入旧版的element-plus/global
- 我们可以在全局类型文件(vite-env.d.ts)中这样写
- ‘///‘ 是有意义的不要删掉了
- 如果在全局tsconfig.json中引入了 ’element-plus/global‘ 那可以不需要 ’reference‘ 了
/// <reference types="element-plus/global" />
import * as ElementPlusGlobal from "@vue/runtime-core";
declare module "vue" {
interface ComponentCustomProperties extends ElementPlusGlobal.GlobalComponents {}
}