-
Notifications
You must be signed in to change notification settings - Fork 96
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
jsx development status for vue 3 #138
Comments
https://github.com/vueComponent/jsx Babel Plugin JSX for Vue 3.0To add Vue JSX support. InstallationInstall the plugin with:
Then add the plugin to .babelrc:
SyntaxContentfunctional component const App = () => <div></div> with render const App = {
render() {
return <div>Vue 3.0</div>
}
} const App = defineComponent(() => {
const count = ref(0);
const inc = () => {
count.value++;
};
return () => (
<div onClick={inc}>
{count.value}
</div>
)
}) fragment const App = () => (
<>
<span>I'm</span>
<span>Fragment</span>
</>
) Attributes/Propsconst App = () => <input type="email" /> with a dynamic binding: const placeholderText = 'email'
const App = () => (
<input
type="email"
placeholder={placeholderText}
/>
) Directives
v-show const App = {
data() {
return { visible: true };
},
render() {
return <input vShow={this.visible} />;
},
}; v-model
export default {
data: () => ({
test: 'Hello World',
}),
render() {
return (
<>
<input type="text" vModel_trim={this.test} />
{this.test}
</>
)
},
} |
can this plugin used with the setup method ? |
Yeah, It's also compatible with Vue 2 |
some thing like export default {
setup () {
const count = ref(0);
const inc = () => {
count.value++;
};
return () => (
<div onClick={inc}>
{count.value}
</div>
)
}
} |
It works |
there is error when setup with vue 3 , vue router next . and this plugin export default {
setup () {
return () => (
<div> hi </div>
)
}
} router index import Home from "@/views/Home.jsx"
const routes = [
{
path: "/",
name: "home",
component: Home
}
]
const router = createRouter ({
history: createWebHistory(),
routes
})
export default router error when open home route
|
plz show you babel config and you can create an issue in jsx |
I will open issue there . |
Closing in favor of #141 |
any news about the support of jsx in vue 3 ?
The text was updated successfully, but these errors were encountered: