Answer the question
In order to leave comments, you need to log in
How to pass 1 more value to Vue?
I'm making a calculator like this
. I
connected the first select with the choice of a number - everything recalculates https://codepen.io/Superusernameone/pen/RwrwxRW?ed...
But how to display the result of recalculation in tons? I added the values 1.7 and 1.4 in the array for each object (on the first site there are only 2 values of tons from m3 for all selects) and I want to display the value in tons when choosing a certain select and number, too, i.e. just multiply the number from the object of the selected select by the number that is being selected
Answer the question
In order to leave comments, you need to log in
When calculating totalTon, look up the selected option by its value:
totalTon() {
return this.number * this.options.find(n => n.value === this.selected).ton;
},
:value="option.value"
do :value="option"
. total() {
return this.number * this.selected.value;
},
totalTon() {
return this.number * this.selected.ton;
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question