-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$announcer instance not available with Vue 2 Composition API and TypeScript #27
Comments
It's not an ideal or definitive solution, but it can be temporary until we find a better alternative and add a new version of vue-announcer for Vue 2 with composition-api support. https://codesandbox.io/s/ukxsq?file=/src/components/HelloWorld.vue |
@ktquez thanks a lot, this helps! An idea: Could it be possible to have the option of being able to pass a function as message or complementRoute, especially message, so i18n logics could easily be bound to the configuration? If given a function as a value, you would invoke it and catch it's return value (string expected). For example we could achieve reactive and translatable messages in route object meta config: // import { t } from '@/i18n';
{
name: 'home',
path: '/',
component: Home,
meta: {
announcer: {
message: () => t('PAGE__HOME__TITLE')
}
}
} |
I think it's possible! |
While this plugin does not support TypeScript yet, those errors can be skipped with
// @ts-ignore
comments.However, I'm having major difficulty using this plugin with Composition API for Vue 2. Can't upgrade to Vue 3 yet so next branch is not a solution here.
How can I access $announcer instance from the setup method?
The text was updated successfully, but these errors were encountered: