-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (33 loc) · 799 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { replaceRouteLang } from './i18n.js';
export default {
template: `
<div>
<span>
Lang
</span>
<select :value="$i18n.locale" @input="goToLang($event.target.value)" @change="goToLang($event.target.value)">
<option v-for="lang in $i18n.allowedLocales" v-bind:value="lang">
{{ lang }}
</option>
</select>
<div>
<span>Links</span>
<router-link :to="{ name: 'home' }">
<a>home</a>
</router-link>
<router-link :to="{ name: 'houses' }">
<a>houses</a>
</router-link>
<router-link :to="{ name: 'cars' }">
<a>cars</a>
</router-link>
</div>
<router-view />
</div>
`,
methods: {
goToLang(lang) {
this.$router.push(replaceRouteLang(this.$route, lang));
},
},
};