Refactor #4190 - For Menu
parent
b89643cef1
commit
fd326c4d8d
|
@ -119,6 +119,14 @@ export interface MenuState {
|
|||
* Defines current options in Menu component.
|
||||
*/
|
||||
export interface MenuContext {
|
||||
/**
|
||||
* Current menuitem
|
||||
*/
|
||||
item: any;
|
||||
/**
|
||||
* Current index of the menuitem.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Current focused state of menuitem as a boolean.
|
||||
* @defaultValue false
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</template>
|
||||
</template>
|
||||
<li v-else-if="visible(item) && item.separator" :key="'separator' + i.toString()" :class="[cx('separator'), item.class]" :style="item.style" role="separator" v-bind="ptm('separator')"></li>
|
||||
<PVMenuitem v-else :key="label(item) + i.toString()" :id="id + '_' + i" :item="item" :templates="$slots" :exact="exact" :focusedOptionId="focusedOptionId" @item-click="itemClick" :pt="pt" />
|
||||
<PVMenuitem v-else :key="label(item) + i.toString()" :id="id + '_' + i" :item="item" :index="i" :templates="$slots" :exact="exact" :focusedOptionId="focusedOptionId" @item-click="itemClick" :pt="pt" />
|
||||
</template>
|
||||
</ul>
|
||||
<div v-if="$slots.end" :class="cx('end')" v-bind="ptm('end')">
|
||||
|
|
|
@ -47,7 +47,8 @@ export default {
|
|||
templates: null,
|
||||
exact: null,
|
||||
id: null,
|
||||
focusedOptionId: null
|
||||
focusedOptionId: null,
|
||||
index: null
|
||||
},
|
||||
methods: {
|
||||
getItemProp(processedItem, name) {
|
||||
|
@ -56,6 +57,8 @@ export default {
|
|||
getPTOptions(key) {
|
||||
return this.ptm(key, {
|
||||
context: {
|
||||
item: this.item,
|
||||
index: this.index,
|
||||
focused: this.isItemFocused()
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue