import { getLabel } from "utils/common";
// 挂载全局
app.config.globalProperties.$getLabel = getLabel;
发现在使用的时候vscode会飘红
在shims-vue.d.ts里面扩充类型
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
// 对vue进行类型补充说明
import { ComponentCustomProperties } from 'vue'
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$date: any
$getLabel: any
}
}