parent
5e535e0de0
commit
c8fca257b6
@ -0,0 +1,16 @@
|
|||||||
|
module.exports = {
|
||||||
|
printWidth: 120,
|
||||||
|
tabWidth: 4,
|
||||||
|
useTabs: false,
|
||||||
|
semi: true,
|
||||||
|
singleQuote: true,
|
||||||
|
quoteProps: 'as-needed',
|
||||||
|
jsxSingleQuote: false,
|
||||||
|
trailingComma: 'es5',
|
||||||
|
bracketSpacing: true,
|
||||||
|
bracketSameLine: false,
|
||||||
|
arrowParens: 'always',
|
||||||
|
htmlWhitespaceSensitivity: 'ignore',
|
||||||
|
vueIndentScriptAndStyle: true,
|
||||||
|
endOfLine: 'auto',
|
||||||
|
};
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"module": "esnext",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
<template>
|
|
||||||
<svg class="svg-icon" aria-hidden="true">
|
|
||||||
<use :href="symbolId" :fill="color" />
|
|
||||||
</svg>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default defineComponent({
|
|
||||||
name: 'SvgIcon',
|
|
||||||
props: {
|
|
||||||
prefix: {
|
|
||||||
type: String,
|
|
||||||
default: 'icon',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: '#333',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: [Number, String],
|
|
||||||
default: 16,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup(props) {
|
|
||||||
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
|
|
||||||
const size = computed(() =>
|
|
||||||
typeof new Number(props.size) !== Number.NaN ? props.size + 'px' : props.size
|
|
||||||
);
|
|
||||||
return { symbolId, size };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.svg-icon {
|
|
||||||
width: v-bind(size);
|
|
||||||
height: v-bind(size);
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<template v-if="name">
|
||||||
|
<i v-if="isRemix" class="x-icon" :class="'x-icon-' + name" v-bind="{ ...$props, ...$attrs }"></i>
|
||||||
|
<svg v-else-if="svg" class="x-icon" aria-hidden="true">
|
||||||
|
<use :href="symbolId" :fill="color" />
|
||||||
|
</svg>
|
||||||
|
<el-icon v-else class="x-icon">
|
||||||
|
<component :is="name" v-bind="{ ...$props, ...$attrs }" />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'XIcon',
|
||||||
|
props: {
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 14,
|
||||||
|
},
|
||||||
|
svg: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'inherit',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
const symbolId = computed(() => `#icon-${props.name}`);
|
||||||
|
const size = computed(() =>
|
||||||
|
typeof new Number(props.size) !== Number.NaN ? props.size + 'px' : props.size
|
||||||
|
);
|
||||||
|
const isRemix = computed(() => props.name.indexOf('-') !== -1 || props.isCustomSvg);
|
||||||
|
return {
|
||||||
|
symbolId,
|
||||||
|
size,
|
||||||
|
color: props.color,
|
||||||
|
isRemix,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.x-icon {
|
||||||
|
font-size: v-bind(size);
|
||||||
|
color: v-bind(color);
|
||||||
|
}
|
||||||
|
svg.x-icon {
|
||||||
|
width: v-bind(size);
|
||||||
|
height: v-bind(size);
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,2 @@
|
|||||||
|
import 'virtual:svg-icons-register';
|
||||||
|
import '@/icons/remixicon.less';
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 877 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 200 B |
@ -0,0 +1,4 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
let data = fs.readFileSync('./remixicon.less').toString();
|
||||||
|
let res = data.match(/(?<=\.x-icon-).*?(?=:before)/g);
|
||||||
|
fs.writeFileSync('index.json', JSON.stringify(res));
|
@ -1,6 +1,6 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
import 'virtual:svg-icons-register';
|
import '@/icons';
|
||||||
|
|
||||||
createApp(App).mount('#app');
|
createApp(App).mount('#app');
|
||||||
|
Loading…
Reference in new issue