Skip to content

Commit 1525362

Browse files
committed
fix: 修复element-pro-crud外网cdn引入时初始化options bug
1 parent 425cfcd commit 1525362

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/plugins/element-pro-crud.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import ElementProCrud from 'element-pro-crud';
99
import { crud } from '@/api/public/crud';
1010
import * as pluginsApi from '@/api/system/form';
1111

12-
Vue.use(ElementProCrud, {
12+
const $PROCRUD_OPTION = {
1313
...pluginsApi,
1414
crud,
15-
});
15+
};
16+
// 通过cdn挂载插件时无法传入指定options,直接挂在原型链
17+
if (process.env.VUE_APP_CDN === 'true') {
18+
Vue.prototype.$PROCRUD = $PROCRUD_OPTION;
19+
} else {
20+
Vue.use(ElementProCrud, $PROCRUD_OPTION);
21+
}

0 commit comments

Comments
 (0)