svgicon文件设置name不是必穿项,为了解决name传入 ||
This commit is contained in:
@@ -15,7 +15,8 @@ import { computed } from "vue";
|
||||
const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
// required: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
@@ -30,7 +31,7 @@ const props = defineProps({
|
||||
default: 'rem',
|
||||
}
|
||||
});
|
||||
const iconName = computed(() => `#icon-${props.name}`);
|
||||
const iconName = computed(() => `#icon-${props?.name}`);
|
||||
const svgClass = computed(() => {
|
||||
if (props.name) return `svg-icon icon-${props.name}`;
|
||||
return "svg-icon";
|
||||
|
||||
Reference in New Issue
Block a user