Fixed #4692 - BaseIcon: p-icon and p-icon-spin classes in unstyled mode

pull/4992/head
mertsincan 2023-12-20 13:23:24 +00:00
parent 5663e4e879
commit 4d83ee668e
1 changed files with 8 additions and 14 deletions

View File

@ -17,30 +17,24 @@ export default {
}
},
style: BaseIconStyle,
beforeMount() {
BaseIconStyle.loadStyle({ nonce: this.$config?.csp?.nonce });
},
methods: {
pti() {
const isLabelEmpty = ObjectUtils.isEmpty(this.label);
return {
...(!this.isUnstyled && {
class: [
'p-icon',
{
'p-icon-spin': this.spin
}
],
]
}),
role: !isLabelEmpty ? 'img' : undefined,
'aria-label': !isLabelEmpty ? this.label : undefined,
'aria-hidden': isLabelEmpty
};
}
},
computed: {
$config() {
return this.$primevue?.config;
}
}
};
</script>