Parcourir la source

修改svgicon颜色默认值只有在线链接时赋值

zhontai il y a 2 ans
Parent
commit
dc50e603e5
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      src/components/svgIcon/index.vue

+ 3 - 3
src/components/svgIcon/index.vue

@@ -25,7 +25,6 @@ const props = defineProps({
   // svg 颜色
   color: {
     type: String,
-    default: () => 'currentColor',
   },
 })
 
@@ -58,7 +57,8 @@ const setIconImgOutStyle = computed(() => {
 const setIconSvgInsStyle = computed(() => {
   const filterStyle: string[] = []
   const compatibles: string[] = ['-webkit', '-ms', '-o', '-moz']
-  compatibles.forEach((j) => filterStyle.push(`${j}-filter: drop-shadow(${props.color} ${props.size}px 0);`))
-  return `width: ${props.size}px;height: ${props.size}px;` + (props.color ? `position: relative;left: -${props.size}px;${filterStyle.join('')}` : '')
+  const color = props.color ? props.color : 'currentColor'
+  compatibles.forEach((j) => filterStyle.push(`${j}-filter: drop-shadow(${color} ${props.size}px 0);`))
+  return `width: ${props.size}px;height: ${props.size}px;` + (color ? `position: relative;left: -${props.size}px;${filterStyle.join('')}` : '')
 })
 </script>