2018-03-20 Vue render函数

2018-03-20  本文已影响0人  Lin_XJ

正常的情况下render函数是这样用的:

return h('div', {})

今天想用render函数返回自己写的vue component,想当然地给第一个参数传'my-component',结果一只报错,正确做法应该直接把component装在在第一个参数上:

// 错误做法
return h('my-component', {})

// 正确做法
return h(MyComponent, {})
上一篇下一篇

猜你喜欢

热点阅读