Vue: v-model and v-on="click" with checkbox, different priority chrome and firefox

Created on 12 Aug 2015  ·  8Comments  ·  Source: vuejs/vue

I want to use v-model and v-on with checkbox

like this : <input type="checkbox" v-model="test" v-on="click: foo">

jsfiddle: http://jsfiddle.net/c686xbrn/

but chrome and firefox alert different result

how can I get same? thx

Most helpful comment

Don't use v-on, use watch: http://jsfiddle.net/yyx990803/c686xbrn/1/

All 8 comments

Don't use v-on, use watch: http://jsfiddle.net/yyx990803/c686xbrn/1/

ok thx

but I try to use v-repeat together http://jsfiddle.net/7hk7rz10/

how to I watch them? thx

@yyx990803 How about v-model and v-on:paste="work_shorten" with input textbox?
I would like to have new data when paste event fired.
https://jsfiddle.net/ianpatel/1c1mqcfh/

There is another(but not so that elegant) workaround, wrap you onclick logic with Vue.nextTick

onClickFunc(){
   Vue.nextTick(()=>{
    //here goes your onclick logic
  }); 
}

293

Don't use v-on, use watch: http://jsfiddle.net/yyx990803/c686xbrn/1/

Can you please replace your vue.js CDN URL.

@kushal555 this is a 4 year old issue, applies to Vue 0.11 or something.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robertleeplummerjr picture robertleeplummerjr  ·  3Comments

seemsindie picture seemsindie  ·  3Comments

julianxhokaxhiu picture julianxhokaxhiu  ·  3Comments

paceband picture paceband  ·  3Comments

guan6 picture guan6  ·  3Comments