Merge pull request #5357 from landluck/hotfix/fix_issue_5335_n

fix(icon): fix location error when custom-class
This commit is contained in:
landluck 2023-05-04 10:12:33 +08:00 committed by GitHub
commit a95769652b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -2,13 +2,16 @@
@import '@vant/icons/src/index.less'; @import '@vant/icons/src/index.less';
:host { :host {
position: relative;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.van-icon { .van-icon {
&--custom {
position: relative;
}
&--image { &--image {
width: 1em; width: 1em;
height: 1em; height: 1em;

View File

@ -9,6 +9,10 @@ function isImage(name) {
function rootClass(data) { function rootClass(data) {
var classes = ['custom-class']; var classes = ['custom-class'];
if (data.classPrefix !== 'van-icon') {
classes.push('van-icon--custom')
}
if (data.classPrefix != null) { if (data.classPrefix != null) {
classes.push(data.classPrefix); classes.push(data.classPrefix);
} }