0

got this calculation table initially just one row with simple calculation from price multiply quantity.

var app=new Vue({
         el: "#app",
         data: {
         value: '',
         quantity: '',
         total: 0
       },
     computed: {

         calc: function() {

          return this.total = parseFloat(this.value) * parseFloat(this.quantity);  

          },
     }
  });

then I add same multiple rows with jQuery. But when I wanted to do the same calculations for other rows then its not working. may be as the page is not refreshing and the @{{ calc }} code is not executing. Its just showing {{ calc }} in the other rows.

html code:

<input id="amount" name="amount" required="required" type="text"  v-model="value">

<input id="quantity" name="quantity" required="required" type="number" min="0" value="0"  v-model="quantity">

<p>@{{ calc }}</p>

<button type="button" id="addBillingRow" class="btn btn-success btn-sm fa fa-plus fa-3x"></button>
11
  • IIRC there is a v-html attribute you can use for that kind of thing
    – Taplar
    Commented Nov 17, 2017 at 21:07
  • stackoverflow.com/questions/41688899/vuejs2-v-html-with-filter has an answer with a guy using a reference inside the v-html
    – Taplar
    Commented Nov 17, 2017 at 21:11
  • Each row consists of the two inputs and a p element with calc?
    – Bert
    Commented Nov 17, 2017 at 21:15
  • @Taplar thanks for your quick response but your given reference is too hard for me to understand as i'm just a beginner. It would be great if you kindly give more specific answer related with my codes. Commented Nov 17, 2017 at 21:22
  • Other's may be able to explain it better, :). Basically the v-html attribute on an element, iirc, is a way of invoking dynamic methods in order to generate the markup that will appear within the tag.
    – Taplar
    Commented Nov 17, 2017 at 21:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.