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

363
Views
Vue.prototype vs Vue.use vs import para cada archivo

Estas son algunas de las formas que conozco para crear una función global para el proyecto vue js:

tiempo.js

 // if Vue.use() export default { install: Vue => { Object.defineProperty(Vue.prototype, "time", { return new Date().getTime(); }) } } // else function time () { return new Date().getTime(); } export { time }

principal.js

 ... import { time } from "time"; // if Vue.prototyp Vue.prototype.$time = time // else if Vue.use() Vue.use(time) ...

aplicación.vue

 // if Vue.prototype or Vue.use() console.log(this.$time()); // else import { time } from "time"; console.log(time());

¿Cuál es el mejor método para el proyecto vue js?

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

0

Utilice la import en lugar de contaminar el alcance global.
No se beneficiará de la sacudida de árboles, probablemente tendrá colisiones, es más difícil de depurar y probablemente algunos otros inconvenientes en los que no puedo pensar en este momento.

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!