refactor: icon component

This commit is contained in:
Fine 2022-12-16 10:49:26 +08:00
parent f8cd2849d2
commit f6b075c11c
2 changed files with 3 additions and 9 deletions

View File

@ -24,22 +24,16 @@ limitations under the License. -->
loading,
}"
>
<use :href="symbolId"></use>
<use :href="`#${iconName}`"></use>
</svg>
</template>
<script lang="ts" setup>
import { computed } from "vue";
/*global defineProps */
const props = defineProps({
defineProps({
iconName: { type: String, default: "" },
size: { type: String, default: "sm" },
loading: { type: Boolean, default: false },
prefix: {
type: String,
default: "icon",
},
});
const symbolId = computed(() => `#${props.prefix}-${props.iconName}`);
</script>
<style lang="scss" scoped>
.icon {

View File

@ -48,7 +48,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
// Specify the icon folder to be cached
iconDirs: [path.resolve(__dirname, "./src/assets/icons")],
// Specify symbolId format
symbolId: "icon-[dir]-[name]",
symbolId: "[name]",
}),
],
resolve: {