fuchengshen
2022-06-24 0924fcc06ead4d10ea5d0d579c8224850a0f37a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { iconfontUrl, app } from "/@/config/env";
import { basename } from "/@/cool/utils";
import { createLink } from "../utils";
 
// 主题初始化
 
if (app.theme) {
    const { url, color } = app.theme;
 
    if (url) {
        createLink(url, "theme-style");
    }
 
    document.getElementsByTagName("body")[0].style.setProperty("--color-primary", color);
}
 
// 字体图标库加载
 
if (iconfontUrl) {
    createLink(iconfontUrl);
}
 
// svg 图标加载
 
const svgFiles = import.meta.globEager("/src/icons/svg/**/*.svg");
 
function iconList() {
    const list: string[] = [];
 
    for (const i in svgFiles) {
        list.push(basename(i).replace(".svg", ""));
    }
 
    return list;
}
 
export { iconList };