2018-01-16 07:41:00 +00:00
|
|
|
<script>
|
|
|
|
import { Item, itemProps } from './src/index'
|
|
|
|
import { getClass, getStyle } from '../_util/vnode'
|
|
|
|
import Tooltip from '../tooltip'
|
2018-01-17 08:12:53 +00:00
|
|
|
import { getComponentFromProp } from '../_util/props-util'
|
2018-01-16 07:41:00 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
props: itemProps,
|
|
|
|
inject: {
|
|
|
|
inlineCollapsed: { default: false },
|
|
|
|
},
|
|
|
|
isMenuItem: 1,
|
|
|
|
methods: {
|
|
|
|
onKeyDown (e) {
|
|
|
|
this.$refs.menuItem.onKeyDown(e)
|
|
|
|
},
|
|
|
|
},
|
2018-01-17 08:12:53 +00:00
|
|
|
render (h) {
|
2018-01-16 07:41:00 +00:00
|
|
|
const { inlineCollapsed, $props: props, $slots, $attrs: attrs, $listeners } = this
|
|
|
|
const itemProps = {
|
|
|
|
props,
|
|
|
|
attrs,
|
|
|
|
on: $listeners,
|
|
|
|
class: getClass(this),
|
|
|
|
style: getStyle(this),
|
|
|
|
}
|
|
|
|
return <Tooltip
|
|
|
|
placement='right'
|
|
|
|
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
|
|
|
|
>
|
|
|
|
<template slot='title'>
|
|
|
|
{inlineCollapsed && props.level === 1 ? $slots.default : ''}
|
|
|
|
</template>
|
|
|
|
<Item {...itemProps} ref='menuItem'>
|
|
|
|
{$slots.default}
|
|
|
|
</Item>
|
|
|
|
</Tooltip>
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|