Fixed #246 - Add menubar-left and menubar-right slots to Menubar
parent
27fc8a1947
commit
c4ea3341d2
|
@ -1,9 +1,15 @@
|
|||
<template>
|
||||
<div class="p-menubar p-component">
|
||||
<div class="p-menubar-start" v-if="$slots.start">
|
||||
<slot name="start"></slot>
|
||||
</div>
|
||||
<MenubarSub :model="model" :root="true" />
|
||||
<div class="p-menubar-custom" v-if="$slots.default">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="p-menubar-end" v-if="$slots.end">
|
||||
<slot name="end"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -26,6 +32,7 @@ export default {
|
|||
<style>
|
||||
.p-menubar {
|
||||
padding: .25em;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.p-menubar .p-menu-separator {
|
||||
|
@ -122,7 +129,11 @@ export default {
|
|||
}
|
||||
|
||||
.p-menubar .p-menubar-custom {
|
||||
float: right;
|
||||
margin-left: auto;
|
||||
padding: .25em;
|
||||
}
|
||||
|
||||
.p-menubar .p-menubar-end {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
<div class="content-section implementation">
|
||||
<Menubar :model="items">
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" :style="{'margin-left': '.25em'}"/>
|
||||
<template #end>
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" :style="{'margin-left': '.25em'}"/>
|
||||
</template>
|
||||
</Menubar>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -154,12 +154,16 @@ export default {
|
|||
</CodeHighlight>
|
||||
|
||||
<h3>Custom Content</h3>
|
||||
<p>Any content inside the megamenu will be displayed on the right side by default. You may use ".p-menubar-custom" style class to change the location of the content.</p>
|
||||
<p>Two slots named "start" and "end" are provided to embed content before or after the menubar.</p>
|
||||
<CodeHighlight>
|
||||
<template v-pre>
|
||||
<Menubar :model="items">
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" />
|
||||
<template #start>
|
||||
Before
|
||||
</template>
|
||||
<template #end>
|
||||
After
|
||||
</template>
|
||||
</Menubar>
|
||||
</template>
|
||||
</CodeHighlight>
|
||||
|
@ -241,8 +245,10 @@ export default {
|
|||
<CodeHighlight>
|
||||
<template v-pre>
|
||||
<Menubar :model="items">
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" :style="{'margin-left': '.25em'}"/>
|
||||
<template #end>
|
||||
<InputText placeholder="Search" type="text" />
|
||||
<Button label="Logout" icon="pi pi-power-off" :style="{'margin-left': '.25em'}"/>
|
||||
</template>
|
||||
</Menubar>
|
||||
</template>
|
||||
</CodeHighlight>
|
||||
|
|
Loading…
Reference in New Issue