优化菜单名称过长悬停显示标题
This commit is contained in:
@ -1,29 +1,38 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'MenuItem',
|
||||
name: "MenuItem",
|
||||
functional: true,
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
render(h, context) {
|
||||
const { icon, title } = context.props
|
||||
const vnodes = []
|
||||
const { icon, title } = context.props;
|
||||
const vnodes = [];
|
||||
|
||||
if (icon) {
|
||||
vnodes.push(<svg-icon icon-class={icon}/>)
|
||||
vnodes.push(<svg-icon icon-class={icon} />);
|
||||
}
|
||||
|
||||
if (title) {
|
||||
vnodes.push(<span slot='title'>{(title)}</span>)
|
||||
// vnodes.push(<span slot="title">{title}</span>);
|
||||
if (title.length > 6) {
|
||||
vnodes.push(
|
||||
<span slot="title" title={title}>
|
||||
{title}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
vnodes.push(<span slot="title">{title}</span>);
|
||||
}
|
||||
}
|
||||
return vnodes
|
||||
}
|
||||
}
|
||||
return vnodes;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user