2018-02-17 21:35:18 -06:00
|
|
|
<template>
|
2018-02-19 16:58:21 -06:00
|
|
|
<ul class="menu">
|
2018-02-20 10:39:51 -06:00
|
|
|
<li v-for="(item, i) in menu" :class="item.type">
|
2018-02-17 21:35:18 -06:00
|
|
|
<template v-if="item.type == 'item'">
|
2018-02-18 00:27:06 -06:00
|
|
|
<p @click="click(item)"><span :class="$style.icon" v-if="item.icon" v-html="item.icon"></span>{{ item.text }}</p>
|
2018-02-17 21:35:18 -06:00
|
|
|
</template>
|
2018-02-17 22:48:40 -06:00
|
|
|
<template v-if="item.type == 'link'">
|
2018-02-18 00:27:06 -06:00
|
|
|
<a :href="item.href" :target="item.target" @click="click(item)"><span :class="$style.icon" v-if="item.icon" v-html="item.icon"></span>{{ item.text }}</a>
|
2018-02-17 22:48:40 -06:00
|
|
|
</template>
|
2018-02-17 21:35:18 -06:00
|
|
|
<template v-else-if="item.type == 'nest'">
|
2018-02-18 00:27:06 -06:00
|
|
|
<p><span :class="$style.icon" v-if="item.icon" v-html="item.icon"></span>{{ item.text }}...<span class="caret">%fa:caret-right%</span></p>
|
2018-02-17 21:35:18 -06:00
|
|
|
<me-nu :menu="item.menu" @x="click"/>
|
|
|
|
</template>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'me-nu',
|
|
|
|
props: ['menu'],
|
|
|
|
methods: {
|
|
|
|
click(item) {
|
|
|
|
this.$emit('x', item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-03-02 22:47:55 -06:00
|
|
|
@import '~const.styl'
|
|
|
|
|
2018-04-19 17:45:37 -05:00
|
|
|
root(isDark)
|
2018-02-17 21:35:18 -06:00
|
|
|
$width = 240px
|
|
|
|
$item-height = 38px
|
|
|
|
$padding = 10px
|
|
|
|
|
2018-02-17 22:48:40 -06:00
|
|
|
margin 0
|
|
|
|
padding $padding 0
|
|
|
|
list-style none
|
2018-02-17 21:35:18 -06:00
|
|
|
|
|
|
|
li
|
|
|
|
display block
|
|
|
|
|
2018-02-18 00:27:06 -06:00
|
|
|
&.divider
|
2018-02-17 21:35:18 -06:00
|
|
|
margin-top $padding
|
|
|
|
padding-top $padding
|
2018-04-19 17:45:37 -05:00
|
|
|
border-top solid 1px isDark ? #1c2023 : #eee
|
2018-02-17 21:35:18 -06:00
|
|
|
|
|
|
|
&.nest
|
|
|
|
> p
|
|
|
|
cursor default
|
|
|
|
|
|
|
|
> .caret
|
2018-02-18 00:27:06 -06:00
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
right 8px
|
|
|
|
|
2018-02-17 21:35:18 -06:00
|
|
|
> *
|
|
|
|
line-height $item-height
|
2018-02-18 00:27:06 -06:00
|
|
|
width 28px
|
|
|
|
text-align center
|
2018-02-17 21:35:18 -06:00
|
|
|
|
|
|
|
&:hover > ul
|
|
|
|
visibility visible
|
|
|
|
|
|
|
|
&:active
|
|
|
|
> p, a
|
|
|
|
background $theme-color
|
|
|
|
|
|
|
|
> p, a
|
|
|
|
display block
|
|
|
|
z-index 1
|
|
|
|
margin 0
|
|
|
|
padding 0 32px 0 38px
|
|
|
|
line-height $item-height
|
2018-04-19 17:45:37 -05:00
|
|
|
color isDark ? #c8cece : #868C8C
|
2018-02-17 21:35:18 -06:00
|
|
|
text-decoration none
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
text-decoration none
|
|
|
|
|
|
|
|
*
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
> p, a
|
|
|
|
text-decoration none
|
|
|
|
background $theme-color
|
|
|
|
color $theme-color-foreground
|
|
|
|
|
|
|
|
&:active
|
|
|
|
> p, a
|
|
|
|
text-decoration none
|
|
|
|
background darken($theme-color, 10%)
|
|
|
|
color $theme-color-foreground
|
|
|
|
|
|
|
|
li > ul
|
|
|
|
visibility hidden
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
left $width
|
|
|
|
margin-top -($padding)
|
|
|
|
width $width
|
2018-04-19 17:45:37 -05:00
|
|
|
background isDark ? #282c37 :#fff
|
2018-02-17 21:35:18 -06:00
|
|
|
border-radius 0 4px 4px 4px
|
2018-04-28 18:51:17 -05:00
|
|
|
box-shadow 2px 2px 8px rgba(#000, 0.2)
|
2018-02-17 21:35:18 -06:00
|
|
|
transition visibility 0s linear 0.2s
|
|
|
|
|
2018-04-19 17:45:37 -05:00
|
|
|
.menu[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.menu:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
2018-02-17 21:35:18 -06:00
|
|
|
</style>
|
|
|
|
|
2018-02-18 00:27:06 -06:00
|
|
|
<style lang="stylus" module>
|
|
|
|
.icon
|
|
|
|
> *
|
|
|
|
width 28px
|
|
|
|
margin-left -28px
|
|
|
|
text-align center
|
|
|
|
</style>
|
|
|
|
|