Item.vue 605 Bytes
Newer Older
1 2 3 4 5
<script>
export default {
  name: 'MenuItem',
  functional: true,
  props: {
花裤衩's avatar
花裤衩 committed
6 7 8 9 10 11 12
    icon: {
      type: String,
      default: ''
    },
    title: {
      type: String,
      default: ''
13 14 15
    }
  },
  render(h, context) {
花裤衩's avatar
花裤衩 committed
16
    const { icon, title } = context.props
17 18
    const vnodes = []

dupengyu's avatar
dupengyu committed
19 20 21
    // if (icon) {
    //   vnodes.push(<svg-icon icon-class={icon}/>)
    // }
22 23

    if (title) {
24 25 26 27 28
      if (title.length > 5) {
        vnodes.push(<span slot='title' title={(title)}>{(title)}</span>)
      } else {
        vnodes.push(<span slot='title'>{(title)}</span>)
      }
29 30 31 32 33
    }
    return vnodes
  }
}
</script>