Skip to content

Commit 34feb7a

Browse files
committed
fix: allow reactivity of icon attribute
1 parent b801812 commit 34feb7a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/PrimeInputText.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const props = defineProps({
1818
},
1919
})
2020
21-
function hasIcon() {
21+
const hasIcon = computed(() => {
22+
if (props.context?.icon && props.context?.icon.length > 0) {
23+
return true
24+
}
25+
2226
return props.context?.attrs?.icon && props.context?.attrs?.icon.length > 0
2327
}
2428
@@ -36,7 +40,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3640
<template>
3741
<div class="p-formkit">
3842
{{ context.attrs.icon }}
39-
<IconField v-if="hasIcon()" :icon-position="context?.attrs.iconPosition">
43+
<IconField v-if="hasIcon" :icon-position="context?.attrs.iconPosition">
4044
<InputIcon :class="context.attrs.icon" />
4145
<InputText
4246
:id="context.id"

0 commit comments

Comments
 (0)