vuejs / babel-plugin-transform-vue-jsx

babel plugin for vue 2.0 jsx
1.85k stars 132 forks source link

[feature request] Support model #138

Closed fjc0k closed 6 years ago

fjc0k commented 6 years ago

The api just like:

render() {
  return <CustomInput
    modelValue={this.localValue}
    modelCallback={this.sendValue}
  />
}

It's equivalent to:

<CustomInput v-model="localValue" />

or:

render(h) {
  return h(CustomInput, {
    model: {
      value: this.localValue,
      callback: this.sendValue
    }
  })
}
fjc0k commented 6 years ago

@yyx990803 @nickmessing

What's your idea? Can I make a PR?

fnlctrl commented 6 years ago

It's already supported as a separate plugin :smile: https://github.com/nickmessing/babel-plugin-jsx-v-model

fjc0k commented 6 years ago

@fnlctrl It just supports default model option ({ prop: 'value', event: 'input' }): https://github.com/nickmessing/babel-plugin-jsx-v-model/issues/10

fnlctrl commented 6 years ago

I see.. Feel free to submit a PR to that repo 🙂 .