fix: 优化svg不能去掉fill等属性

This commit is contained in:
harrywan 2024-09-04 09:54:42 +08:00
parent 46f28d6c76
commit 77d2b09121
4 changed files with 46 additions and 45 deletions

View File

@ -1,38 +1,38 @@
{
"name": "@fesjs/plugin-icon",
"version": "3.0.0",
"description": "@fesjs/plugin-icon",
"main": "lib/index.js",
"files": [
"lib",
"types.d.ts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-plugin-icon"
},
"keywords": [
"fes"
],
"author": "qlin",
"license": "MIT",
"bugs": {
"url": "https://github.com/WeBankFinTech/fes.js/issues"
},
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@fesjs/fes": "^3.0.0",
"vue": "^3.2.47"
},
"dependencies": {
"svgo": "^3.0.2"
},
"typings": "./types.d.ts"
"name": "@fesjs/plugin-icon",
"version": "3.0.0",
"description": "@fesjs/plugin-icon",
"author": "qlin",
"license": "MIT",
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-plugin-icon"
},
"bugs": {
"url": "https://github.com/WeBankFinTech/fes.js/issues"
},
"keywords": [
"fes"
],
"main": "lib/index.js",
"files": [
"lib",
"types.d.ts"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@fesjs/fes": "^3.0.0",
"vue": "^3.2.47"
},
"dependencies": {
"svgo": "^3.0.2"
},
"typings": "./types.d.ts"
}

View File

@ -1,5 +1,5 @@
import { extname, basename } from 'path';
import { statSync, readFileSync } from 'fs';
import { basename, extname } from 'node:path';
import { readFileSync, statSync } from 'node:fs';
import { optimize } from 'svgo';
const presetDefault = [
@ -15,7 +15,7 @@ const presetDefault = [
{
name: 'removeAttrs',
params: {
attrs: '(fill|stroke|class)',
attrs: '(class)',
},
},
];

View File

@ -1,8 +1,8 @@
import { computed } from 'vue';
// eslint-disable-next-line
import icons from '../icons';
const noop = () => {};
function noop() {}
export default {
name: 'FesIcon',
@ -19,9 +19,9 @@ export default {
const svgStyle = computed(() =>
props.rotate
? {
msTransform: `rotate(${props.rotate}deg)`,
transform: `rotate(${props.rotate}deg)`,
}
msTransform: `rotate(${props.rotate}deg)`,
transform: `rotate(${props.rotate}deg)`,
}
: null,
);
const svgCls = computed(() => ({

View File

@ -29,6 +29,7 @@
&[tabindex] {
cursor: pointer;
}
&--spin {
display: inline-block;
animation: loadingCircle 1s infinite linear;
@ -46,5 +47,5 @@
transform: rotate(360deg);
}
}
}