jsx-vue2
jsx-vue2 copied to clipboard
feat(babel-sugar-inject-h): add support for functional jsx `h` injections
Add support for purge functional jsx construct with h
be auto injected. eg.
const compGenerator = (funcRender, customize) => { /* factory for variant components generator */ }
const Foo = compGenerator((ctx) => (
<C { ...ctx } scopedSlots={{
foo: ({ value }) => (<Item value={ value } />)
}} />
), {})
=>
var compGenerator = function (funcRender, customize) { /* factory for variant components generator */ };
var Foo = compGenerator(function (h, ctx) {
return h("C", _mergeJSXProps([{}, ctx, {
"scopedSlots": {
foo: function foo(_ref) {
var value = _ref.value;
return h("Item", {
"attrs": {
"value": value
}
});
}
}
}]));
}, {});
Also support any purge functional render-like
code snippet:
new Vue({
...
foo: function () { return <C /> }
render: () => <App />
})
=>
new Vue({
...
foo: function (h) { return h(<C />) }
render: (h) => h(<App />)
})