| 12345678910111213141516171819202122232425262728 |
- // == collection start
- const collections = {
- default: __default__,
- }
- // == collection end
- const svglib = {}
- svglib.registerCollection = (key, lib) => {
- if (collections[key]) {
- return
- }
- if (typeof lib.registerCollection === 'function') {
- collections[key] = lib.getCollection('default')
- } else {
- collections[key] = lib
- }
- }
- svglib.getCollection = (key = 'default') => {
- if (!collections[key]) throw new Error(`没有找到名为 ${key} 的图标库。`)
- return collections[key]
- }
- export const SvgIconLib = svglib
- export default SvgIconLib
|