mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Improved Dropdown component and fixed some js errors
This commit is contained in:
parent
c0a4dae3e5
commit
d6968c99ba
@ -4,7 +4,7 @@
|
|||||||
:open-group="Math.random().toString()"
|
:open-group="Math.random().toString()"
|
||||||
:placement="placement"
|
:placement="placement"
|
||||||
trigger="manual"
|
trigger="manual"
|
||||||
offset="10"
|
:offset="offset"
|
||||||
>
|
>
|
||||||
<slot :toggleMenu="toggleMenu" />
|
<slot :toggleMenu="toggleMenu" />
|
||||||
<div
|
<div
|
||||||
@ -12,7 +12,10 @@
|
|||||||
@mouseover="popoverMouseEnter"
|
@mouseover="popoverMouseEnter"
|
||||||
@mouseleave="popoveMouseLeave"
|
@mouseleave="popoveMouseLeave"
|
||||||
>
|
>
|
||||||
<slot name="popover" />
|
<slot
|
||||||
|
name="popover"
|
||||||
|
:toggleMenu="toggleMenu"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</v-popover>
|
</v-popover>
|
||||||
</template>
|
</template>
|
||||||
@ -25,7 +28,8 @@ let mouseLeaveTimer = null
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
placement: { type: String, default: 'bottom-end' }
|
placement: { type: String, default: 'bottom-end' },
|
||||||
|
offset: { type: [String, Number], default: '16' }
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<dropdown
|
<dropdown
|
||||||
ref="menu"
|
ref="menu"
|
||||||
placement="right-start"
|
:placement="placement"
|
||||||
|
:offset="offset"
|
||||||
>
|
>
|
||||||
<template
|
<template
|
||||||
slot="default"
|
slot="default"
|
||||||
@ -55,6 +56,10 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Dropdown
|
Dropdown
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
placement: { type: String, default: 'right-start' },
|
||||||
|
offset: { type: [String, Number], default: '16' }
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
current() {
|
current() {
|
||||||
return find(this.locales, ['code', this.$i18n.locale()])
|
return find(this.locales, ['code', this.$i18n.locale()])
|
||||||
|
|||||||
@ -8,7 +8,13 @@
|
|||||||
>
|
>
|
||||||
<ds-logo />
|
<ds-logo />
|
||||||
</a>
|
</a>
|
||||||
<locale-switch class="topbar-locale-switch" />
|
<no-ssr>
|
||||||
|
<locale-switch
|
||||||
|
class="topbar-locale-switch"
|
||||||
|
placement="bottom"
|
||||||
|
offset="24"
|
||||||
|
/>
|
||||||
|
</no-ssr>
|
||||||
<template v-if="isLoggedIn">
|
<template v-if="isLoggedIn">
|
||||||
<no-ssr>
|
<no-ssr>
|
||||||
<dropdown class="avatar-menu">
|
<dropdown class="avatar-menu">
|
||||||
@ -30,13 +36,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
slot="popover"
|
slot="popover"
|
||||||
class="avatar-menu-popover"
|
slot-scope="{toggleMenu}"
|
||||||
>
|
>
|
||||||
|
<div class="avatar-menu-popover">
|
||||||
{{ $t('login.hello') }} <b>{{ user.name }}</b>
|
{{ $t('login.hello') }} <b>{{ user.name }}</b>
|
||||||
<ds-menu
|
<ds-menu
|
||||||
:routes="routes"
|
:routes="routes"
|
||||||
:is-exact="isExact"
|
:is-exact="isExact"
|
||||||
style="margin-left: -15px; margin-right: -15px; padding-top: 1rem; padding-bottom: 1rem;"
|
|
||||||
>
|
>
|
||||||
<ds-menu-item
|
<ds-menu-item
|
||||||
slot="Navigation"
|
slot="Navigation"
|
||||||
@ -52,6 +58,7 @@
|
|||||||
<nuxt-link :to="{ name: 'logout'}">
|
<nuxt-link :to="{ name: 'logout'}">
|
||||||
<ds-icon name="sign-out" /> {{ $t('login.logout') }}
|
<ds-icon name="sign-out" /> {{ $t('login.logout') }}
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</dropdown>
|
</dropdown>
|
||||||
</no-ssr>
|
</no-ssr>
|
||||||
@ -125,9 +132,16 @@ export default {
|
|||||||
.avatar-menu {
|
.avatar-menu {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.avatar-popup-menu {
|
.avatar-menu-popover {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin-left: -15px;
|
||||||
|
margin-right: -15px;
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -19,7 +19,9 @@
|
|||||||
:width="{ base: '100%', sm: '50%' }"
|
:width="{ base: '100%', sm: '50%' }"
|
||||||
center
|
center
|
||||||
>
|
>
|
||||||
|
<no-ssr>
|
||||||
<locale-switch class="login-locale-switch" />
|
<locale-switch class="login-locale-switch" />
|
||||||
|
</no-ssr>
|
||||||
<ds-space
|
<ds-space
|
||||||
margin-top="small"
|
margin-top="small"
|
||||||
margin-bottom="xxx-small"
|
margin-bottom="xxx-small"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user