Refactor #4351 - For Dock

pull/4356/head
Tuğçe Küçükoğlu 2023-08-30 09:40:37 +03:00
parent 3e59aa18b9
commit 340e6a82e5
2 changed files with 24 additions and 1 deletions

View File

@ -23,6 +23,11 @@ import DockSub from './DockSub.vue';
export default {
name: 'Dock',
extends: BaseDock,
beforeMount() {
if (!this.$slots.item) {
console.warn('In future versions, vue-router support will be removed. Item templating should be used.');
}
},
computed: {
containerClass() {
return [this.class, this.cx('root')];

View File

@ -64,7 +64,7 @@
<component v-else :is="templates['icon']" :item="processedItem" :class="cx('icon')"></component>
</a>
</template>
<component v-else :is="templates['item']" :item="processedItem" :index="index"></component>
<component v-else :is="templates['item']" :item="processedItem" :index="index" :label="processedItem.label" :props="getMenuItemProps(processedItem, index)"></component>
</div>
</li>
</template>
@ -275,6 +275,24 @@ export default {
},
disabled(item) {
return typeof item.disabled === 'function' ? item.disabled() : item.disabled;
},
getMenuItemProps(item, index) {
return {
action: mergeProps(
{
tabindex: -1,
'aria-hidden': true,
class: this.cx('action')
},
this.getPTOptions('action', item, index)
),
icon: mergeProps(
{
class: [this.cx('icon'), item.icon]
},
this.getPTOptions('icon', item, index)
)
};
}
},
computed: {