babel-plugin-vue-jsx-sync
babel plugin to support vue jsx sync modifier
9,548
| Install | |
|---|---|
npm install babel-plugin-vue-jsx-sync |
|
| Latest Version: | 0.0.5 |
| License: | ISC |
| Last Updated: | Apr 10, 2018 |
| Links: | npm |
Maintainer: njleonzhang
babel-plugin-vue-jsx-sync
jsx plugin for vue sync modifier, inspired by babel-plugin-jsx-v-model
Usage
- 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 (
<div>
<component visible$sync={this.test}>I am newbie</component>
</div>
)
}
Notice: we need to use
visible$syncinstead ofvisible.sync, becausevisible.syncis an illegal syntax injsx.
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"]
)]
);
}
dev
npm install -g parcel-bundler
npm install
npm run dev
build doc
npm run doc
Version History
| Version | Released | License |
|---|---|---|
| 0.0.5 | ISC | |
| 0.0.4 | ISC | |
| 0.0.3 | ISC | |
| 0.0.2 | ISC | |
| 0.0.1 | ISC |