refactor: #7090 for Dock
parent
f061fc1d02
commit
08cc312f62
|
@ -2,7 +2,7 @@
|
||||||
<div :class="cx('listContainer')" v-bind="ptm('listContainer')">
|
<div :class="cx('listContainer')" v-bind="ptm('listContainer')">
|
||||||
<ul
|
<ul
|
||||||
ref="list"
|
ref="list"
|
||||||
:id="id"
|
:id="idx"
|
||||||
:class="cx('list')"
|
:class="cx('list')"
|
||||||
role="menu"
|
role="menu"
|
||||||
:aria-orientation="position === 'bottom' || position === 'top' ? 'horizontal' : 'vertical'"
|
:aria-orientation="position === 'bottom' || position === 'top' ? 'horizontal' : 'vertical'"
|
||||||
|
@ -59,7 +59,6 @@
|
||||||
import { find, findSingle } from '@primeuix/utils/dom';
|
import { find, findSingle } from '@primeuix/utils/dom';
|
||||||
import { resolve } from '@primeuix/utils/object';
|
import { resolve } from '@primeuix/utils/object';
|
||||||
import BaseComponent from '@primevue/core/basecomponent';
|
import BaseComponent from '@primevue/core/basecomponent';
|
||||||
import { UniqueComponentId } from '@primevue/core/utils';
|
|
||||||
import Ripple from 'primevue/ripple';
|
import Ripple from 'primevue/ripple';
|
||||||
import Tooltip from 'primevue/tooltip';
|
import Tooltip from 'primevue/tooltip';
|
||||||
import { mergeProps } from 'vue';
|
import { mergeProps } from 'vue';
|
||||||
|
@ -102,23 +101,14 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: this.menuId,
|
|
||||||
currentIndex: -3,
|
currentIndex: -3,
|
||||||
focused: false,
|
focused: false,
|
||||||
focusedOptionIndex: -1
|
focusedOptionIndex: -1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
menuId(newValue) {
|
|
||||||
this.id = newValue || UniqueComponentId();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.id = this.id || UniqueComponentId();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getItemId(index) {
|
getItemId(index) {
|
||||||
return `${this.id}_${index}`;
|
return `${this.idx}_${index}`;
|
||||||
},
|
},
|
||||||
getItemProp(processedItem, name) {
|
getItemProp(processedItem, name) {
|
||||||
return processedItem && processedItem.item ? resolve(processedItem.item[name]) : undefined;
|
return processedItem && processedItem.item ? resolve(processedItem.item[name]) : undefined;
|
||||||
|
@ -277,6 +267,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
focusedOptionId() {
|
focusedOptionId() {
|
||||||
return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null;
|
return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null;
|
||||||
|
},
|
||||||
|
idx() {
|
||||||
|
return this.menuId || this.$id;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
|
|
Loading…
Reference in New Issue