vuejs / vue-class-component

ES / TypeScript decorator for class-style Vue components.
MIT License
5.81k stars 429 forks source link

How to get global properties in a page? #552

Open vivianus-chan opened 3 years ago

vivianus-chan commented 3 years ago

const app = createApp(App); app.config.globalProperties.$http = axios; app.use(store).use(router).mount("#app");

How to get $http and $router in export default class Login extends Vue {}?

JeremCafeyn commented 2 years ago

Hello @vivianus-chan ! Did you find a solution for this issue? I am migration my Vue 2 app to Vue 3 and before to refacto all the app with the composition API, I'm still using the Class Component. And I can't access to my global properties inside my classes...

letShirochiki commented 2 years ago

@JeremCafeyn You can create a new .d.ts file and read here https://vuex.vuejs.org/guide/typescript-support.html