diff --git a/src/main.ts b/src/main.ts index 592de58..86ca715 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,8 +50,9 @@ app.use(router); app.use(store); app.use(i18n); app.use(VXETable); +// 全局方法 属性 app.use(plugins); // 自定义指令 -directive(app); +app.use(directive); app.mount('#app'); diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 6c5e0c3..c869c25 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,12 +1,12 @@ import modal from './modal'; import tab from './tab'; -import download from './download'; +import ossDownload from './download'; import cache from './cache'; import auth from './auth'; // 预设动画 import animate from '@/animate'; -import { download as dl } from '@/utils/request'; +import { download } from '@/utils/request'; import { useDict } from '@/utils/dict'; import { getConfigKey, updateConfigByKey } from '@/api/system/config'; import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'; @@ -24,20 +24,37 @@ export default function installPlugin(app: App) { app.config.globalProperties.$cache = cache; // 下载文件 - app.config.globalProperties.$download = download; + app.config.globalProperties.$download = ossDownload; // 认证对象 app.config.globalProperties.$auth = auth; + app.provide('$tab', tab); + app.provide('$modal', modal); + app.provide('$cache', cache); + app.provide('$ossDownload', ossDownload); + app.provide('$auth', auth); + // 全局方法挂载 app.config.globalProperties.useDict = useDict; app.config.globalProperties.getConfigKey = getConfigKey; app.config.globalProperties.updateConfigByKey = updateConfigByKey; - app.config.globalProperties.download = dl; + app.config.globalProperties.download = download; app.config.globalProperties.parseTime = parseTime; app.config.globalProperties.handleTree = handleTree; app.config.globalProperties.addDateRange = addDateRange; app.config.globalProperties.selectDictLabel = selectDictLabel; app.config.globalProperties.selectDictLabels = selectDictLabels; app.config.globalProperties.animate = animate; + + app.provide('useDict', useDict); + app.provide('getConfigKey', getConfigKey); + app.provide('updateConfigByKey', updateConfigByKey); + app.provide('download', download); + app.provide('parseTime', parseTime); + app.provide('handleTree', handleTree); + app.provide('addDateRange', addDateRange); + app.provide('selectDictLabel', selectDictLabel); + app.provide('selectDictLabels', selectDictLabels); + app.provide('animate', animate); }