Vue学习笔记
一、二维数组尝试
1
2
3
4
5
6
7
| var vm = new Vue({
el: "#app",
data: {
huilv:[
[6.8540, 132.9787, 1298.7013, 1.3278],
[6.8540, 132.9787, 1298.7013, 1.3278]
],}
|
二、watch监听实现
1
2
3
4
5
6
7
8
| watch: {
first: function(newValue) {
this.second = newValue * this.huilv[Number(this.firstbutton - 1)][Number(this.secondbutton -1)];
},
second: function(newValue) {
this.first = newValue / this.huilv[Number(this.firstbutton - 1)][Number(this.secondbutton -1)];
}
}
|
三、数组的更新检测
#变更方法
Vue 将被侦听的数组的变更方法进行了包裹,所以它们也将会触发视图更新。这些被包裹过的方法包括: