can provide dynamic component with template tag, 能否支持 动态组件 的is属性是空/template
What problem does this feature solve?
now the dynamic component the attribute of "is" must be a html tag or a componet tag, sometimes , I want the dynamic component the attribute of "is" is empty such as
<component :is="showTip? 'el-tootip':''template" >
<el-button>button</el-button>
</compnent>
the example I want if the showTip is true, the button will be wrapped by a tooltip component
else if the showTip is false, there is nothing wrapped the button
so I want vue can provide the component :is with empty
现状是 动态组件 component :is的 is属性只能是 html标签或者已经注册的组件标签
但有时 需求想 is是个空值,
比如有这样的需求
<component :is="showTip? 'el-tootip':''template" >
<el-button>button</el-button>
</compnent>
给一个button添加tooltip功能, 提供一个 showTip的字段, 如果为true则 则button组件会被一个tooltip组件包裹, 如果此字段为false则不会被任何元素包裹, 所以希望vue能够提供 动态组件 is属性是空值
What does the proposed API look like?
<component :is="showTip? 'el-tootip':''template" >
<el-button>button</el-button>
</compnent>
<component :is="showTip? 'el-tootip':''" >
<el-button>button</el-button>
</compnent>
你可以提供一个 wrapper 组件,我给你提供了一个例子:https://codesandbox.io/s/nervous-mcnulty-necyx?file=/src/App.vue