LoginSignup
0
0

More than 5 years have passed since last update.

Vue progress input v-model and watch

Posted at

v-model="xx" => watch:{xx:function(n,o){...} }

<script src="https://unpkg.com/vue"></script>
<div id="bbb">
<input v-model='v'></input>
<progress :value='v2' :max='max' :title='title'></progress>
</div>
new Vue({
 el:'#bbb'
 ,data:{v:10,max:1000,v2:10,title:this.v}
 ,watch:{//v-model:x is watch the x
  v:function(n,o){this.check(n,o)}
 }
 ,methods:{
  check:function(n,o){//new old
   console.log(n,o)
   this.title=n;
   if(isNaN(n))return this.title=`burning value:${n}`
   this.v2=n;
  } 
 }
})
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0