| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <nav>
- <RouterLink to="/">{{ t("Home") }}</RouterLink>
- <RouterLink v-for="link in links" v-model="links" :to="`${link.page.path}`">
- {{ link.Label }}
- </RouterLink>
- <select @change="changeLocale()" v-model="$i18n.locale">
- <option v-for="(lang, i) in $i18n.availableLocales" :key="`Lang${i}`" :value="lang">
- {{ lang }}
- </option>
- </select>
- </nav>
- </template>
- <style scoped>
- nav {
- width: 100%;
- font-size: 12px;
- text-align: center;
- line-height: 90px;
- margin: 0;
- padding: 0;
- }
- nav a.router-link-exact-active {
- color: var(--color-text);
- }
- nav a.router-link-exact-active:hover {
- background-color: transparent;
- }
- nav a, nav select {
- display: inline-block;
- padding: 0 1rem;
- border-left: 1px solid var(--color-border);
- }
- nav a:first-of-type {
- border: 0;
- }
- </style>
- <script lang="ts">
- import { useFooterLinksStore } from '@/stores/footer-content-pages'
- import {loadDynamicPages} from '@/router'
- import { useI18n } from 'vue-i18n'
- export default {
- name: 'Navigation',
- data () {
- return {
- links: [] as Array<any>,
- error: null as any,
- footerLinksStroe: null as any
- }
- },
- setup(){
- const { t } = useI18n({
- inheritLocale: true
- })
- return{
- t
- }
- },
- async mounted () {
- if(!this.footerLinksStroe){
- this.footerLinksStroe = useFooterLinksStore()
- }
-
- this.links = await this.footerLinksStroe.getLinks(this.$i18n.locale)
- },
- methods:{
- async changeLocale(){
- let locale = this.$i18n.locale
- loadDynamicPages(locale)
- localStorage.setItem('lang',locale)
- if(!this.footerLinksStroe){
- this.footerLinksStroe = useFooterLinksStore()
- }
- this.links = await this.footerLinksStroe.getLinks(locale)
-
- }
- }
-
- }
- </script>
|