cool-admin-vue/cool/modules/base/common/index.js

23 lines
554 B
JavaScript
Raw Normal View History

2021-02-28 01:55:04 +08:00
import { iconfontUrl } from "@/config/env";
if (iconfontUrl) {
const link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = iconfontUrl;
document.getElementsByTagName("head")[0].appendChild(link);
}
const requireAll = (requireContext) => requireContext.keys().map(requireContext);
const req = require.context("@/icons/svg/", false, /\.svg$/);
requireAll(req);
export function iconList() {
return req
.keys()
.map(req)
.map((e) => e.default.id)
.filter((e) => e.includes("icon"))
.sort();
}