cannot use Vue i18n in slot templates
See original GitHub issueReported by @AbrahamBrookes in #14:
It seems that using the new slot feature breaks reference to my root vue app? I have a component that sits inside the eventContent slot, and I can no longer access my root vue instance (in particular, my vuex store) from that component:
<full-calendar
:options="calOptions"
>
<template v-slot:eventContent="event" >
<planner-period
:event="event"
></planner-period>
</template>
</full-calendar>
Inside the planner-period component when I try to access my store data using this.$store.state I get this.$store is undefined. Is the calendar creating its own entirely new vue app?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Vue i18n-$t undefined outside template
Hi, Try using this.$t . – Yash Maheshwari · Where are you doing this ? Inside of data() ? – kissu · @kissu...
Read more >I18n not working inside named slot - Get Help
I'm using theme vuexy which is made with VueSax. Inside table I want to use expand. (here is demo, click on table row...
Read more >Breaking Changes
Vue I18n is no longer a class but a set of functions. Instead of writing new VueI18n() , you now have to call...
Read more >The Ultimate Vue Localization Guide
In this hands-on guide, we'll use Vue I18n to internationalize a little demo app, covering everything you need to get started with Vue ......
Read more >API references | Vue I18n
Whether to allow the use locale messages of HTML formatting. If you set warn or error , will check the locale messages on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve merged the PR and released everything in v5.4.0!
@arshaw I don’t think this would suffice. You still have to pass in the same i18n instance as option when initializing the Vue instance for the event content, as shown in https://kazupon.github.io/vue-i18n/started.html#javascript
Building on the
attributes
proposal from @kgilden: Maybe it’s possible to extract all non-default properties fromthis.$root.$options
which would boil down toi18n
,store
,router
, or whatever option is injected to the root Vue instance. That way the user wouldn’t have to replicate her intial Vue setup and still could make use of her Vuex store, i18n, or router state inside the scoped slot.