Item.vue 596 B

123456789101112131415161718192021222324252627282930313233
  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. if (icon) {
  19. vnodes.push(<svg-icon icon-class={icon}/>)
  20. }
  21. if (title) {
  22. if (title.length > 5) {
  23. vnodes.push(<span slot='title' title={(title)}>{(title)}</span>)
  24. } else {
  25. vnodes.push(<span slot='title'>{(title)}</span>)
  26. }
  27. }
  28. return vnodes
  29. }
  30. }
  31. </script>