wonderful-panda / vue-tsx-support

TSX (JSX for TypeScript) support library for Vue
MIT License
560 stars 40 forks source link

mixed usage of composition-api and object-style render #75

Closed wonderful-panda closed 3 years ago

wonderful-panda commented 3 years ago

This code should work.

import * as vca from "vue-tsx-support/lib/vca";

export const MyDialog = vca.component({
  setup() {
    // I want expose `show` as a public method of component
    // To expose `show`, I can't return render function from `setup` directly
    // return () => (<div>...</div>);

    const show = () => {
        ...
    };
    const render_ = () => (
      <div>...</div>
    );
    return { show, render_ };
  },
  render() {
     return this.render_();
  }
})