0👍
Here’s a working example. Might be a bit overkill, but I only had few minutes to write the code 🙂
var app = new Vue({
el: '#app',
data: {
dm: 1,
dmtoeur: 0.51,
},
methods: {
calculateDmToEur: function() {
this.dmtoeur = (Math.round(((this.dm / 1.95583) + 0.00001) * 100) / 100);
},
},
})
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<div id="app">
<input type='number' v-model='dm' @click="calculateDmToEur()" @keyup="calculateDmToEur()">
<input type='number' v-model='dmtoeur'>
</div>
- [Vuejs]-Appending and render a Vue component using js
- [Vuejs]-Vuejs component doesn't always show fetched data
Source:stackexchange.com