Skip to content

Commit

Permalink
fix: 优化svg不能去掉fill等属性
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun committed Sep 4, 2024
1 parent 46f28d6 commit 77d2b09
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 45 deletions.
72 changes: 36 additions & 36 deletions packages/fes-plugin-icon/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 3 additions & 3 deletions packages/fes-plugin-icon/src/optimizeSvg.js
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -15,7 +15,7 @@ const presetDefault = [
{
name: 'removeAttrs',
params: {
attrs: '(fill|stroke|class)',
attrs: '(class)',
},
},
];
Expand Down
10 changes: 5 additions & 5 deletions packages/fes-plugin-icon/src/runtime/Icon/Icon.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { computed } from 'vue';
// eslint-disable-next-line

import icons from '../icons';

const noop = () => {};
function noop() {}

export default {
name: 'FesIcon',
Expand All @@ -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(() => ({
Expand Down
3 changes: 2 additions & 1 deletion packages/fes-plugin-icon/src/runtime/Icon/icon.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
&[tabindex] {
cursor: pointer;
}

&--spin {
display: inline-block;
animation: loadingCircle 1s infinite linear;
Expand All @@ -46,5 +47,5 @@
transform: rotate(360deg);
}
}

}

0 comments on commit 77d2b09

Please sign in to comment.