I'm new to vueJS+laravel and Here is the VueJs Component under laravel5.8 Currently, it has two buttons on selection they create dynamic input fields, I'm trying to get the multiplication of values dynamically entered by user as a total =?. please help - thanks
<template>
<div><form type="get" action="/asd">
<div>
<label>Add A</label>
<button type="button" @click="addRow">100</button>
</div>
<div> <label>Add B</label>
<button type="button" @click="addRow1">200</button>
</div>
<div v-for="row in rows" :key="row.id">
<button-counter :name ="row.name" :id="row.id" :value="row.value"></button-counter>
</div>
<div>
<li>total = ?</li>
</div>
<button>submit</button>
</form>
</div>
</template>
<script type="text/javascript">
Vue.component("button-counter", {
props: {
value: {
default: ""
}
},
template: '<input name=row.name type="text" style="margin-top: 10px;" v-model="value" >'
});
export default {
data() {
return {
rows: [],
count: 0
};
},
methods: {
addRow: function() {
var txtCount = 1;
let id = "txt_" + txtCount;
this.rows.push({ name:'A',value:100, description: "textbox1", id });
},
addRow1: function() {
var txtCount = 1;
let id = "txt2_" + txtCount;
this.rows.push({name:'B',value:200, description: "textbox2", id });
}
}
};