Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed render JSX h to api composition v1x #13

Closed
wants to merge 1 commit into from

Conversation

joaomede
Copy link

@joaomede joaomede commented Jul 7, 2020

#11
The Problem: The latest version of Composition API removed the "createElement" import, now the method is located in context, in "ctx.root.$createElement", so in this Pull Request I removed the "autoImportH" function and added the function "insertDeclareCreateElement",

what does it do?

inserts "const h = ctx.root.$createElement" into the "setup" scope.

ex.:

import { defineComponent } from '@vue/composition-api'

export const ElementTest = defineComponent ({
   setup: (prop, ctx) => {
     // here
     const h = ctx.root.$createElement

     return () => {
       return (
         <div>
           <h2> test </h2>
         </div>
       )
     }
   }
})

@antfu
Copy link

antfu commented Jul 7, 2020

@joaomede createElement is not removed, it renamed to h instead to align with Vue 3. A PR #12 for this is already made. Thanks.

@joaomede
Copy link
Author

joaomede commented Jul 7, 2020

@antfu is true, i saw here that it is simply called "h" now, the cool thing is that context.root.$createElement also worked, now just wait for the fix to enter the release.

@joaomede joaomede closed this Jul 14, 2020
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.

2 participants