Open punyflash opened 2 years ago
Oh, that regression will be a deal breaker for our efforts of migrating a project to vue 3 for now.
I did read about getCurrentInstance(…)
though, in the context of $router
, maybe that'll help?
import { getCurrentInstance } from 'vue'
export default {
setup () {
const { ctx } = getCurrentInstance()
console.log(ctx.$router.currentRoute.value)
}
The docs don't like that use-case, though: https://v3.vuejs.org/api/composition-api.html#getcurrentinstance
⚠️ Do NOT use it as an escape hatch to get the equivalent of
this
in Composition API.
And
getCurrentInstance
only works during setup or Lifecycle Hooks
Thanks for your contribution to vue-meta! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like this issue to remain open:
pending
will not be automatically marked as stale.Still can reproduce
Reproduced here ✋
This fix still relevant https://github.com/nuxt/vue-meta/pull/736
In my case it was fixed (using typescript as well) when I set manually type of computed property, like this:
isProceedBtnActive (): boolean {
return this.error.status
}
Withous ": boolean" it shows an error. Strange behavior
In my case it was fixed (using typescript as well) when I set manually type of computed property, like this:
isProceedBtnActive (): boolean { return this.error.status }
Withous ": boolean" it shows an error. Strange behavior
This is not a computed property but a custom hook, your issue was not relevant to this one.
This is not a computed property but a custom hook, your issue was not relevant to this one.
I mean, you probably may need to set the type of edit in data explicitly
data() {
return {
edit: this.$route.params?.id as string | number
}
},
This is not a computed property but a custom hook, your issue was not relevant to this one.
I mean, you probably may need to set the type of edit in data explicitly
data() { return { edit: this.$route.params?.id as string | number } },
The issue is in metaInfo
this
scope, all is ok with component state. And it was fixed by me in #736, however seems like project is abandoned so it was just ignored.
When using options API:
TypeScript throws errors:
P.S. Code itself works well, this is only typescript issue. And to be honest I'm not sure it's because of library, the issue could be related to vue 3 core.