babel plugin to support vue jsx sync modifier
npm install babel-plugin-vue-jsx-sync* Demo
* install
```
yarn add -D babel-plugin-vue-jsx-sync
or
npm install babel-plugin-vue-jsx-sync --save-dev
* add the plugin to .babelrc``
{
"presets": [
["env", {
"modules": false
}],
"stage-2"
],
"plugins": ["transform-runtime", "vue-jsx-sync", "transform-vue-jsx"],
......
}
}
* use in jsx
`
function a() {
return (
)
}
`visible$sync
> Notice: we need to use instead of visible.sync, because visible.sync is an illegal syntax in jsx.
is complied to:
``
function a() {
return h(
"div",
null,
[h(
"component",
{
attrs: { visible: this.test },
on: {
"update:visible": $$val => {
this.test = $$val;
}
}
},
["I am newbie"]
)]
);
}
``
npm install -g parcel-bundler
npm install
npm run dev
```
npm run doc