Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

475
Views
Vue.js, ¿cómo puedo sumar los valores que imprimo?

Trabajo en un sitio comercial y cuando el cliente ordena un producto hago lo siguiente: Imprimo primero el precio del producto por ejemplo $60 Luego si el cliente elige el servicio de envío rápido, imprimo el valor del servicio de envío express, por ejemplo, $20. ¿Cómo sumo e imprimo números en total?

 <ul> <li>Price : {{product.product_price}} Doller</li> <li v-if="orderData.fastDelivry">Fast delivry : {{delevryValue}} Doller</li> <li>Total : </li> </ul>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba como el siguiente fragmento:

 new Vue({ el: '#demo', data() { return { product: { name: 'prod 1', product_price: 15 }, orderData: { fastDelivry: false }, delevryValue: 5 } }, computed: { total() { return (this.orderData.fastDelivry ? this.product.product_price + this.delevryValue : this.product.product_price) } }, methods: { setDelivery() { this.orderData.fastDelivry = !this.orderData.fastDelivry } } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="demo"> <ul> <li>Price : {{product.product_price}} Doller</li> <input type="checkbox" @click="setDelivery" /> fast delivery <li v-if="orderData.fastDelivry">Fast delivry : {{delevryValue}} Doller</li> <li>Total : {{ total }}</li> </ul> </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!