Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected failure with v-model in some compiled codes before 2.5.0 #6803

Closed
KagamiChan opened this issue Oct 13, 2017 · 5 comments
Closed

Comments

@KagamiChan
Copy link

Version

2.5.0

Reproduction link

https://jsfiddle.net/skagami/b3tkrpmv/2/

Steps to reproduce

  • click on the radio element, and no console output
  • change vue version to 2.4.4, click on the radio again, and voila the console output

What is expected?

vue can handle the event on the input element

What is actually happening?

vue dose not handle this event


The render() part is modified from compiled code with vue@2.4.x from element-ui's radio-button component

It seems that the compilation for v-model for this component has changed between vue@2.4.4 and vue@2.5.0

consider a simplified template:

<input type="radio" v-model="value" :value="foobar" >

with vue-template-compiler@2.4.4 the output is:

render: 'with(this){return _c(\'input\',{directives:[{name:"model",rawName:"v-model",value:(value),expression:"value"}],attrs:{"type":"radio"},domProps:{"value":foobar,"checked":_q(value,foobar)},on:{"__c":function($event){value=foobar}}})}',

with vue-template-compiler@2.5.0, the event name changes:

render: 'with(this){return _c(\'input\',{directives:[{name:"model",rawName:"v-model",value:(value),expression:"value"}],attrs:{"type":"radio"},domProps:{"value":foobar,"checked":_q(value,foobar)},on:{"change":function($event){value=foobar}}})}',

I don't know if this is a feature, or the template is not correctly written.

@KagamiChan KagamiChan changed the title unexpected failure with v-model in some compile codes before 2.5.0 unexpected failure with v-model in some compiled codes before 2.5.0 Oct 13, 2017
@vuejs vuejs deleted a comment from zhuyunhe Oct 13, 2017
@posva
Copy link
Member

posva commented Oct 13, 2017

Can you please put the actual template that lead to that output?

@javoski
Copy link
Member

javoski commented Oct 13, 2017

In version 2.5, Vue is not using the token '__c' to represent change event for radio and checkbox anymore.
Why are you using Vue 2.5 to run the code generated by v2.4? 🤔

@javoski javoski closed this as completed Oct 13, 2017
@KagamiChan
Copy link
Author

KagamiChan commented Oct 13, 2017

@javoski An example: some UI libraries are released in compiled code to work both in webpack and browser

IMO it might be a little difficult to assure that all 3rd party libraries in a project are always compiled under the same minor version

This seems resulting a breaking change for 3rd party libs, I suggest it be documented

@posva
Copy link
Member

posva commented Oct 13, 2017

It's true that people need to re-bundle their libs. @yyx990803 I think we should communicate on this. I remember we did something similar in the past.

@yyx990803
Copy link
Member

FYI this is unintended - we will preserve backwards compat in the next patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants