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

235
Views
Vue/Vuex: distingue matrices de objetos en objetos proxy

Como se indica aquí , los objetos Vuex reactivos se devuelven como objetos Proxy. Esto puede no ser un problema en la mayoría de los casos, pero ¿cómo determino si el Proxy se originó a partir de una matriz u objeto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El Proxy es una capa transparente en la parte superior de la matriz/objeto, por lo que no necesitaría determinar la fuente original del Proxy .

La variable en sí debe tratarse como si la capa Proxy no estuviera allí. Si es un Proxy de un Array , trate la variable como un Array , y lo mismo para Object . Ejecute el siguiente fragmento de código para ver ejemplos.

 const arr = [1,2,3] const arrProxy = new Proxy(arr, {}) // value is identical to `arr` console.log(arrProxy.map(x => x * 10)) // => [ 10, 20, 30 ] console.log('isArray', Array.isArray(arrProxy)) // => true const obj = { foo: true, bar: false } const objProxy = new Proxy(obj, {}) // value is identical to `obj` console.log(Object.keys(objProxy)) // => [ 'foo', 'bar' ] console.log('objArray type:', typeof objProxy) // => object

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!