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