Skip to content

Conversation

allex
Copy link
Contributor

@allex allex commented Nov 17, 2020

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 />)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant