vue Render函数的使用方法

image.png

原来代码


改进之后

const { icon, title } = context.props
    const vnodes = []
    if (icon) {
      const elHtml  = createElement('svg-icon',{
        attrs: {
          'icon-class': icon
        }
      })
      vnodes.push(elHtml)
    }
    if (title) {
      const elHtml  = createElement('span',{
        attrs: {
          slot: title,
        }
      },title)
      vnodes.push(elHtml)
    }
    return vnodes

你可能感兴趣的:(vue Render函数的使用方法)