caoge c760052ff9 机车状态修改 | пре 8 месеци | |
---|---|---|
.. | ||
dist | пре 8 месеци | |
node_modules | пре 8 месеци | |
README.md | пре 8 месеци | |
package.json | пре 8 месеци |
Syntactic sugar for v-model in JSX.
Install the dependencies:
# for yarn:
yarn add @vue/babel-sugar-v-model
# for npm:
npm install @vue/babel-sugar-v-model --save
In your .babelrc
:
{
"plugins": ["@vue/babel-sugar-v-model"]
}
However it is recommended to use the configurable preset instead.
This plugin adds v-model to the JSX and tries to mirror the same behaviour as in vue-template-compiler, with a few differences:
_
) instead of dot (.
) for modifiers (vModel_trim={this.test}
)vModel
) in JSX, but you can use kebab-case too (v-model
).export default {
data: () => ({
test: 'Hello World',
}),
render(h) {
return (
<div>
<input type="text" vModel_trim={this.test} />
{this.test}
</div>
)
},
}