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