修改svg-icon组件样式

This commit is contained in:
不做码农 2022-04-19 18:05:15 +08:00
parent 511f2b43c0
commit e82c6528e4
2 changed files with 15 additions and 23 deletions

View File

@ -13,11 +13,11 @@ export default defineComponent({
}, },
className: { className: {
type: String, type: String,
default: "", default: '',
}, },
color: { color: {
type: String, type: String,
default: "", default: '',
}, },
}, },
setup(props) { setup(props) {
@ -25,29 +25,21 @@ export default defineComponent({
iconName: computed(() => `#icon-${props.iconClass}`), iconName: computed(() => `#icon-${props.iconClass}`),
svgClass: computed(() => { svgClass: computed(() => {
if (props.className) { if (props.className) {
return `svg-icon ${props.className}`; return `svg-icon ${props.className}`
} }
return "svg-icon"; return 'svg-icon'
}), }),
}; }
}, },
}); })
</script> </script>
<style scope lang="scss"> <style scope lang="scss">
.sub-el-icon,
.nav-icon {
display: inline-block;
font-size: 15px;
margin-right: 12px;
position: relative;
}
.svg-icon { .svg-icon {
width: 1em; width: 1em;
height: 1em; height: 1em;
position: relative; vertical-align: -0.15em;
fill: currentColor; fill: currentColor;
vertical-align: -2px; overflow: hidden;
} }
</style> </style>

View File

@ -1,10 +1,10 @@
import * as components from '@element-plus/icons-vue' import * as components from '@element-plus/icons-vue'
export default { export default {
install: (app) => { install: (app) => {
for (const key in components) { for (const key in components) {
const componentConfig = components[key]; const componentConfig = components[key];
app.component(componentConfig.name, componentConfig); app.component(componentConfig.name, componentConfig);
} }
}, },
}; };