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

118
Views
vuejs a través de CDN "TypeError no detectado: eliminar no es una función"

Estoy importando Vue.js por CDN y el método "eliminar" no funcionó:

 <sidebar :cart="cart" :remove="removeItem" /> <script src="https://unpkg.com/vue@next"></script> <script> let app = Vue.createApp({ data() { return { cart: {} } }, methods: { addToCart(name,index) { if (!this.cart[name]) this.cart[name]=0 this.cart[name] += this.inventory[index].quantity this.inventory[index].quantity=0 }, removeItem(name){ delete this.cart[name] } }) app.component('sidebar',{ props:['cart','remove'], template:` <aside class="cart-container"> <tbody> <tr v-for="(quantity,key,i) in cart" :key="i"> <td><i class="icofont-carrot icofont-3x"></i></td> <td>{{key}}</td> <td>\${{getPrice(key)}}</td> <td class="center">{{quantity}}</td> <td>\${{ (quantity*getPrice(key)).toFixed(2) }}</td> <td class="center"> <button @click="remove(key)" class="btn btn-light cart-remove"> &times; </button> </td> </tr> </tbody>

el google chrome dio el error de que:

la información del error

Me dijeron que esta solución alternativa solo aparece cuando se usa CDN, no npm. Pero todavía me pregunto por qué "eliminar" aquí no se considera una función. Gracias por delante.

about 4 years ago · Juan Pablo Isaza
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!