common-mini-components
Version:
公共组件
32 lines (25 loc) • 846 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) => {
console.log('-----lai1------')
globalProp.globalIHelpData = {} as IGlobalIHelp
}
const installMethods = (_globalProp: ComponentCustomProperties) => {
}
const withInstallDirective = (_globalProp: ComponentCustomProperties) => {
}
export const GlobalPropPlugin: Plugin = {
install(app: App) {
console.log('-----lai0------')
const globalProp = app.config.globalProperties
installProps(globalProp)
installMethods(globalProp)
withInstallDirective(globalProp)
},
}