Created
November 9, 2015 19:34
-
-
Save martinlindhe/f34489126eb635cb241f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-for="lang in languages"> | |
<language :name="lang.name" :code="lang.code"></language> | |
{{ $t('nav.about') }} | |
</div> | |
</template> | |
<script> | |
import Vue from 'vue'; | |
export default { | |
data() { | |
return { | |
lang: Vue.config.lang, | |
languages: [ | |
{ | |
code: 'sv_SE', | |
name: 'Svenska' | |
}, | |
{ | |
code: 'en_US', | |
name: 'American English' | |
} | |
] | |
} | |
}, | |
components: { | |
language: { | |
props: ['code', 'name'], | |
template: '<p @click="Select">{{ name }}</p>', | |
methods: { | |
Select(e) { | |
console.log("code " + this.code); | |
Vue.config.lang = this.code; | |
} | |
} | |
} | |
} | |
} | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment