From 4d83ee668e50bedb47ad68fbf3493604e101ab66 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 20 Dec 2023 13:23:24 +0000 Subject: [PATCH] Fixed #4692 - BaseIcon: p-icon and p-icon-spin classes in unstyled mode --- components/lib/baseicon/BaseIcon.vue | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/components/lib/baseicon/BaseIcon.vue b/components/lib/baseicon/BaseIcon.vue index 8cbcdf251..bd92349e3 100644 --- a/components/lib/baseicon/BaseIcon.vue +++ b/components/lib/baseicon/BaseIcon.vue @@ -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 { - class: [ - 'p-icon', - { - 'p-icon-spin': this.spin - } - ], + ...(!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; - } } };