提交 | 用户 | 时间
|
a57dc2
|
1 |
import loadScript from './loadScript' |
W |
2 |
import ELEMENT from 'element-ui' |
|
3 |
import pluginsConfig from './pluginsConfig' |
|
4 |
|
|
5 |
let beautifierObj |
|
6 |
|
|
7 |
export default function loadBeautifier(cb) { |
|
8 |
const { beautifierUrl } = pluginsConfig |
|
9 |
if (beautifierObj) { |
|
10 |
cb(beautifierObj) |
|
11 |
return |
|
12 |
} |
|
13 |
|
|
14 |
const loading = ELEMENT.Loading.service({ |
|
15 |
fullscreen: true, |
|
16 |
lock: true, |
|
17 |
text: '格式化资源加载中...', |
|
18 |
spinner: 'el-icon-loading', |
|
19 |
background: 'rgba(255, 255, 255, 0.5)' |
|
20 |
}) |
|
21 |
|
|
22 |
loadScript(beautifierUrl, () => { |
|
23 |
loading.close() |
|
24 |
// eslint-disable-next-line no-undef |
|
25 |
beautifierObj = beautifier |
|
26 |
cb(beautifierObj) |
|
27 |
}) |
|
28 |
} |