//单一入口
window.onload = function(){
//建立vue对象
var app = new Vue({
el:"#app",
data:{
kilometers:0,
meters:0,
},
//监听属性逻辑
watch:{
kilometers:function(val){
this.kilometers =val;
this.meters =val *1000;
},
meters:function(val){
this.kilometers =val /1000;
this.meters.val;
}
}
});
var app1 = new Vue({
el:"#app1",
data:{
seconds:0,
minutes:0,
hours:0
},
//监听属性
watch:{
seconds:function(val){
this.seconds = val;
this.minutes = val/60;
this.hours=val/3600;
},
minutes:function(val){
this.seconds = val*60;
this.minutes =val;
this.hours = val/60;
},
hours: function(val){
this.seconds = val*3600;
this.minutes = val *60;
this.hours= val;
}
}
});
}
千米:
米:
时:
分:
秒:
谢谢各位点评。希望跟各位的一起讨论学习!可以评论留下联系方式!