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

239
Views
¿Cómo declarar más explícitamente una variable que a través de const?

Tengo un componente ( NoteComponent ) que emite note-not-saved . Este mensaje se maneja a través de

 <template> (...) <NoteComponent @note-not-saved='() => noteNotSaved=true' /> (...) </template>

noteNotSaved en sí está definido en mi sección <script> :

 <script setup lang='ts'> (...) const noteNotSaved = ref(false) (...) </script>

La aplicación funciona bien, sin embargo, tengo una advertencia débil de mi IDE (JetBrains GoLand o WebStorm)

 Variable noteNotSaved implicitly declared

¿Qué quiere decir eso exactamente? ¿Cómo se puede noteNotSaved más explícitamente que eso?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El IDE puede considerar noteNotSaved=true como una declaración implícita de una variable global.

Intenta cambiar su valor de la siguiente manera:

 const { createApp, ref } = Vue; const NoteComponent = { template: `<button @click="$emit('note-not-saved')">Click</button>` }; const App = { components: { NoteComponent }, setup() { const noteNotSaved = ref(false); const setNoteAsNotSaved = () => { noteNotSaved.value = true; } return { noteNotSaved, setNoteAsNotSaved }; } }; createApp(App).mount("#myApp");
 <script src="//unpkg.com/vue@next"></script> <div id="myApp"> <div><note-component @note-not-saved="setNoteAsNotSaved" /></div> <div><p>Note Not Saved: {{noteNotSaved}}</p></div> </div>

over 4 years ago · Santiago Trujillo 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!