Refactor #4351 - For Dock
parent
3e59aa18b9
commit
340e6a82e5
|
@ -23,6 +23,11 @@ import DockSub from './DockSub.vue';
|
||||||
export default {
|
export default {
|
||||||
name: 'Dock',
|
name: 'Dock',
|
||||||
extends: BaseDock,
|
extends: BaseDock,
|
||||||
|
beforeMount() {
|
||||||
|
if (!this.$slots.item) {
|
||||||
|
console.warn('In future versions, vue-router support will be removed. Item templating should be used.');
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
containerClass() {
|
containerClass() {
|
||||||
return [this.class, this.cx('root')];
|
return [this.class, this.cx('root')];
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<component v-else :is="templates['icon']" :item="processedItem" :class="cx('icon')"></component>
|
<component v-else :is="templates['icon']" :item="processedItem" :class="cx('icon')"></component>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
@ -275,6 +275,24 @@ export default {
|
||||||
},
|
},
|
||||||
disabled(item) {
|
disabled(item) {
|
||||||
return typeof item.disabled === 'function' ? item.disabled() : item.disabled;
|
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: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue