Remove "class-name" from svg icon (#33540)

Only use "class" attribute

(cherry picked from commit 06088ec672a053b11a20ca6dd21588380d67f396)
This commit is contained in:
wxiaoguang 2025-02-10 04:39:54 +08:00 committed by Gusted
parent d81baf21e9
commit 0ff2c11432
No known key found for this signature in database
GPG key ID: FD821B732837125F
5 changed files with 20 additions and 30 deletions

View file

@ -192,7 +192,6 @@ export const SvgIcon = {
props: {
name: {type: String, required: true},
size: {type: Number, default: 16},
className: {type: String, default: ''},
symbolId: {type: String},
},
render() {
@ -207,15 +206,7 @@ export const SvgIcon = {
attrs[`^width`] = this.size;
attrs[`^height`] = this.size;
// make the <SvgIcon class="foo" class-name="bar"> classes work together
const classes = [];
for (const cls of svgOuter.classList) {
classes.push(cls);
}
// TODO: drop the `className/class-name` prop in the future, only use "class" prop
if (this.className) {
classes.push(...this.className.split(/\s+/).filter(Boolean));
}
const classes = Array.from(svgOuter.classList);
if (this.symbolId) {
classes.push('tw-hidden', 'svg-symbol-container');
svgInnerHtml = `<symbol id="${this.symbolId}" viewBox="${attrs['^viewBox']}">${svgInnerHtml}</symbol>`;