babel-preset-vue
Babel preset for all Vue plugins.
Install
npm install -D babel-preset-vue
CDN: UNPKG
Usage
{
"presets": ["vue"]
}
Supports event modifiers.
Uses babel-plugin-jsx-event-modifier
for event modifiers.
Example:
Vue.component('hello-world', {
methods: {
method () {
console.log('clicked')
}
},
render () {
return (
<div>
<a href="/" onClick:prevent={this.method} />
</div>
)
}
})
More information available on plugin's github page.
Supports v-model.
Uses babel-plugin-jsx-v-model
for two-way data binding with form elements.
Example:
Vue.component('hello-world', {
data: () => ({
text: 'Hello World!'
}),
render () {
return (
<div>
<input type="text" v-model={this.text} />
{this.text}
</div>
)
}
})
More information available on plugin's github page.
License
MIT © EGOIST