I want to make a calculator to calculate the size of the armature on vue.js. When the weight changes, the length must be calculated, and when the length changes, the weight. But since there are general data here, for example, after calculating the length, the weight is immediately recalculated. As well as adding a second method to calculate the weight, you cannot change the value in the field with a length.
https://jsfiddle.net/6t5qokc9/
// 'ΠΠΈΠΌΠ°ΡΠ΅Ρ Π°ΡΠΌΠ°ΡΡΡΡ' => 'ΠΏΡΠΎΠΏΠΎΡΡΠΈΡ' // ΠΠ»Ρ Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ ΠΌΠ°ΡΡΡ Π² ΠΊΠ³ Π½ΡΠΆΠ½ΠΎ ΡΠΌΠ½ΠΎΠΆΠΈΡΡ Π½Π° ΠΏΡΠΎΠΏΠΎΡΡΠΈΡ // ΠΠ»Ρ Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ Π΄Π»ΠΈΠ½Ρ Π² ΠΌΠ΅ΡΡΠ°Ρ
Π½ΡΠΆΠ½ΠΎ ΡΠ°Π·Π΄Π΅Π»ΠΈΡΡ Π½Π° ΠΏΡΠΎΠΏΠΎΡΡΠΈΡ var armatura = { 6: 0.222, 8: 0.395, 10: 0.617, 12: 0.888, 14: 1.21, 16: 1.58, 18: 2, 20: 2.47, 22: 2.98, 25: 3.85, 28: 4.83, 32: 6.31, 36: 7.99, 40: 9.87 } var calc = new Vue({ el: '#calc', data: { selected: 'ΠΡΠ±Π΅ΡΠΈΡΠ΅ Π΄ΠΈΠ°ΠΌΠ΅ΡΡ', kilo: 1, metr: 1, armatura: armatura }, methods: { calcMetr: function(selected, kilo) { selected = +selected; this.metr = kilo * armatura[selected]; this.metr.toFixed(3); }, // calcKg: function(selected, metr) { // selected = +selected; // this.kilo = metr / armatura[selected]; // this.kilo.toFixed(3); // } }, })