@relaxed/vue-directives
Version:
vue 兼容2 3 工具库 函数库
19 lines (18 loc) • 431 B
text/typescript
import { log, featLog, debugLog } from './src/log'
import { isVue3 } from '../../compatible/isVue3'
const logKeys: any = {
log,
debugLog,
featLog
}
export default function (app: any) {
if (isVue3(app)) {
Object.keys(logKeys).forEach((item) => {
app.config.globalProperties[item] = logKeys[item]
})
} else {
Object.keys(logKeys).forEach((item) => {
app.prototype[item] = logKeys[item]
})
}
}