0👍
Some hints on how to use the variables in vue:
data() return {
pv: {
p: '',
pd: '',
d: '',
u: '',
w: '',
},
},
methods: {
calc1() { // no function keyword required
let pv = this.pv; // shorthand
pv.d = pv.p - pv.d;
pv.w = pv.pd - pv.u;
},
calc2() {
let pv = this.pv;
if(pv.w < 1000){
pv.w = 1000 - pv.u;
} else {
pv.w = pv.w - pv.u;
}
},
calc3() {
let pv = this.pv;
for(let i=0; i<10; i++){
pv.w += pv.u*i;
}
}
- [Vuejs]-Rendering dynamic table displays cell contents in wrong order
- [Vuejs]-Assign a value in Vue.js onchange of input
Source:stackexchange.com