Skip to content

Commit

Permalink
Refactor #4953 - For SplitButton
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Feb 2, 2024
1 parent ae45937 commit 784f7d9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/lib/splitbutton/SplitButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
:disabled="disabled"
aria-haspopup="true"
:aria-expanded="isExpanded"
:aria-controls="ariaId + '_overlay'"
:aria-controls="id + '_overlay'"
@click="onDropdownButtonClick"
@keydown="onDropdownKeydown"
:severity="severity"
Expand All @@ -50,7 +50,7 @@
</slot>
</template>
</PVSButton>
<PVSMenu ref="menu" :id="ariaId + '_overlay'" :model="model" :popup="true" :autoZIndex="autoZIndex" :baseZIndex="baseZIndex" :appendTo="appendTo" :unstyled="unstyled" :pt="ptm('menu')">
<PVSMenu ref="menu" :id="id + '_overlay'" :model="model" :popup="true" :autoZIndex="autoZIndex" :baseZIndex="baseZIndex" :appendTo="appendTo" :unstyled="unstyled" :pt="ptm('menu')">
<template v-if="$slots.menuitemicon" #itemicon="slotProps">
<slot name="menuitemicon" :item="slotProps.item" :class="slotProps.class" />
</template>
Expand All @@ -74,10 +74,18 @@ export default {
emits: ['click'],
data() {
return {
id: this.$attrs.id,
isExpanded: false
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.$watch('$refs.menu.visible', (newValue) => {
this.isExpanded = newValue;
});
Expand Down Expand Up @@ -106,9 +114,6 @@ export default {
}
},
computed: {
ariaId() {
return UniqueComponentId();
},
containerClass() {
return [this.cx('root'), this.class];
}
Expand Down

0 comments on commit 784f7d9

Please sign in to comment.