parent
49d380cf99
commit
fa0241a535
3 changed files with 70 additions and 30 deletions
|
@ -5,12 +5,20 @@
|
||||||
<Icon type="ios-arrow-down" :class="[prefixCls + '-submenu-title-icon']"></Icon>
|
<Icon type="ios-arrow-down" :class="[prefixCls + '-submenu-title-icon']"></Icon>
|
||||||
</div>
|
</div>
|
||||||
<ul :class="[prefixCls]" v-if="mode === 'vertical'" v-show="opened"><slot></slot></ul>
|
<ul :class="[prefixCls]" v-if="mode === 'vertical'" v-show="opened"><slot></slot></ul>
|
||||||
<Drop v-else v-show="opened" placement="bottom" transition="slide-up" v-ref:drop><slot></slot></Drop>
|
<Drop
|
||||||
|
v-else
|
||||||
|
v-show="opened"
|
||||||
|
placement="bottom"
|
||||||
|
transition="slide-up"
|
||||||
|
v-ref:drop
|
||||||
|
:style="dropStyle"><slot></slot></Drop>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Drop from '../select/dropdown.vue';
|
import Drop from '../select/dropdown.vue';
|
||||||
import Icon from '../icon/icon.vue';
|
import Icon from '../icon/icon.vue';
|
||||||
|
import { getStyle } from '../../utils/assist';
|
||||||
|
|
||||||
const prefixCls = 'ivu-menu';
|
const prefixCls = 'ivu-menu';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -30,7 +38,8 @@
|
||||||
return {
|
return {
|
||||||
prefixCls: prefixCls,
|
prefixCls: prefixCls,
|
||||||
active: false,
|
active: false,
|
||||||
opened: false
|
opened: false,
|
||||||
|
dropWidth: parseFloat(getStyle(this.$el, 'width'))
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -49,6 +58,12 @@
|
||||||
},
|
},
|
||||||
accordion () {
|
accordion () {
|
||||||
return this.$parent.accordion;
|
return this.$parent.accordion;
|
||||||
|
},
|
||||||
|
dropStyle () {
|
||||||
|
let style = {};
|
||||||
|
|
||||||
|
if (this.dropWidth) style.minWidth = `${this.dropWidth}px`;
|
||||||
|
return style;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -94,6 +109,8 @@
|
||||||
opened (val) {
|
opened (val) {
|
||||||
if (this.mode === 'vertical') return;
|
if (this.mode === 'vertical') return;
|
||||||
if (val) {
|
if (val) {
|
||||||
|
// set drop a width to fixed when menu has fixed position
|
||||||
|
this.dropWidth = parseFloat(getStyle(this.$el, 'width'));
|
||||||
this.$refs.drop.update();
|
this.$refs.drop.update();
|
||||||
} else {
|
} else {
|
||||||
this.$refs.drop.destroy();
|
this.$refs.drop.destroy();
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
{
|
{
|
||||||
[`${prefixCls}-disabled`]: this.disabled
|
[`${prefixCls}-disabled`]: this.disabled
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -61,9 +61,9 @@
|
||||||
[`${prefixCls}-star-full`]: full,
|
[`${prefixCls}-star-full`]: full,
|
||||||
[`${prefixCls}-star-zero`]: !full
|
[`${prefixCls}-star-zero`]: !full
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
},
|
},
|
||||||
handleMousemove(value, event) {
|
handleMousemove(value) {
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
|
|
||||||
if (this.allowHalf) {
|
if (this.allowHalf) {
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
// this.currentValue = this.value;
|
// this.currentValue = this.value;
|
||||||
this.hoverIndex = -1;
|
this.hoverIndex = -1;
|
||||||
},
|
},
|
||||||
handleClick (value) {
|
handleClick () {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,51 @@
|
||||||
<template>
|
<template>
|
||||||
<Menu mode="horizontal" theme="primary" active-key="1">
|
<div style="margin: 50px;position:relative;top: 0;left: 0;">
|
||||||
<Submenu key="1">
|
<Menu mode="horizontal" :theme="theme1" active-key="1">
|
||||||
<template slot="title">
|
<Menu-item key="1">
|
||||||
<Icon type="soup-can-outline"></Icon>
|
<Icon type="ios-paper"></Icon>
|
||||||
数据管理
|
内容管理
|
||||||
</template>
|
</Menu-item>
|
||||||
<Menu-group title="使用">
|
<Menu-item key="2">
|
||||||
<Menu-item key="1-1">新增和启动新增和启动</Menu-item>
|
<Icon type="ios-people"></Icon>
|
||||||
<Menu-item key="1-2">活跃分析</Menu-item>
|
用户管理
|
||||||
<Menu-item key="1-3">时段分析</Menu-item>
|
</Menu-item>
|
||||||
</Menu-group>
|
<Menu-item key="1">
|
||||||
<Menu-group title="留存">
|
<Icon type="ios-paper"></Icon>
|
||||||
<Menu-item key="1-4">用户留存</Menu-item>
|
内容管理
|
||||||
<Menu-item key="1-5">流失用户</Menu-item>
|
</Menu-item>
|
||||||
</Menu-group>
|
<Menu-item key="2">
|
||||||
</Submenu>
|
<Icon type="ios-people"></Icon>
|
||||||
</Menu>
|
用户管理
|
||||||
<br>
|
</Menu-item>
|
||||||
<p>切换主题</p>
|
<Menu-item key="1">
|
||||||
<Radio-group :model.sync="theme1">
|
<Icon type="ios-paper"></Icon>
|
||||||
<Radio value="light"></Radio>
|
内容管理
|
||||||
<Radio value="dark"></Radio>
|
</Menu-item>
|
||||||
<Radio value="primary"></Radio>
|
<Menu-item key="2">
|
||||||
</Radio-group>
|
<Icon type="ios-people"></Icon>
|
||||||
|
用户管理
|
||||||
|
</Menu-item>
|
||||||
|
<Submenu key="3">
|
||||||
|
<template slot="title">
|
||||||
|
<Icon type="stats-bars"></Icon>
|
||||||
|
统计分析
|
||||||
|
</template>
|
||||||
|
<Menu-group title="使用">
|
||||||
|
<Menu-item key="3-1">新增和新</Menu-item>
|
||||||
|
<Menu-item key="3-2">活跃分析</Menu-item>
|
||||||
|
<Menu-item key="3-3">时段分析</Menu-item>
|
||||||
|
</Menu-group>
|
||||||
|
<Menu-group title="留存">
|
||||||
|
<Menu-item key="3-4">用户留存</Menu-item>
|
||||||
|
<Menu-item key="3-5">流失用户</Menu-item>
|
||||||
|
</Menu-group>
|
||||||
|
</Submenu>
|
||||||
|
<Menu-item key="4">
|
||||||
|
<Icon type="settings"></Icon>
|
||||||
|
综合设置
|
||||||
|
</Menu-item>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
|
Loading…
Add table
Reference in a new issue