common-mini-components
Version:
公共组件
30 lines (23 loc) • 778 B
text/typescript
import { App, Plugin, ComponentCustomProperties } from "vue";
import { IGlobalIHelp } from "../../api/types/ihelp";
// 如果向全局添加方法了需要开启声明
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
globalIHelpData: IGlobalIHelp
}
}
const installProps = (globalProp: ComponentCustomProperties) => {
globalProp.globalIHelpData = {} as IGlobalIHelp
}
const installMethods = (_globalProp: ComponentCustomProperties) => {
}
const withInstallDirective = (_globalProp: ComponentCustomProperties) => {
}
export const GlobalPropPlugin: Plugin = {
install(app: App) {
const globalProp = app.config.globalProperties
installProps(globalProp)
installMethods(globalProp)
withInstallDirective(globalProp)
},
}