Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
Vue3 property 'x' does not exist on type 'Function' for global property

I have a Quasar app and seem to be having a weird issue. I am trying to define a global variable that is an object just containing meta info about the app. The app compiles fully, and the correct info shows up in the HTML, but I get an error in VSCode.

src/boot/BackChat.js

import { boot } from 'quasar/wrappers';

const version = '0.0.0';

const backChat = {
  version
};


export default boot(({ app, router, store }) => {
  app.config.globalProperties.backChat = backChat;
});

Login.vue

// ...
<script>
import { ref } from 'vue';

export default {
  data() {
    return {
      backChat: this.backChat
    };
  }
}
</script>

Error in Login.vue on backChat.version

Am I using this interface wrong or is this just a bug with the Vue file validation? It seems it thinks "backChat" in Login.vue is a function. If I change the data() to mounted(), it is no longer a function, but then I cannot access it in the DOM. I am very new to Vue.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I have a workaround which is the simplest approach. I am not sure if this is how your supposed to do it but, since it was thinking that it was a function, I just made the globalProperty a function that returns the object.

src/boot/BackChat.js

// ...
export default boot(({ app, router, store }) => {
  app.config.globalProperties.$backChat = () => backChat;
});

Login.vue

// ...
data() {
    return {
      username,
      password,
      backChat: this.$backChat()
    };
},

This fixes the error highlighted in the Vue file, and allows the same usage of the global object.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda