提交 | 用户 | 时间
|
e57a89
|
1 |
<script> |
懒 |
2 |
export default { |
|
3 |
name: 'MenuItem', |
|
4 |
functional: true, |
|
5 |
props: { |
|
6 |
icon: { |
|
7 |
type: String, |
|
8 |
default: '' |
|
9 |
}, |
|
10 |
title: { |
|
11 |
type: String, |
|
12 |
default: '' |
|
13 |
} |
|
14 |
}, |
|
15 |
render(h, context) { |
|
16 |
const { icon, title } = context.props |
|
17 |
const vnodes = [] |
|
18 |
|
|
19 |
if (icon) { |
|
20 |
vnodes.push(<svg-icon icon-class={icon}/>) |
|
21 |
} |
|
22 |
|
|
23 |
if (title) { |
|
24 |
if (title.length > 5) { |
|
25 |
vnodes.push(<span slot='title' title={(title)}>{(title)}</span>) |
|
26 |
} else { |
|
27 |
vnodes.push(<span slot='title'>{(title)}</span>) |
|
28 |
} |
|
29 |
} |
|
30 |
return vnodes |
|
31 |
} |
|
32 |
} |
|
33 |
</script> |