- import Vue from 'vue'
- import App from './App'
- import VueI18n from 'vue-i18n'
- Vue.use(VueI18n)
- Vue.config.productuinTip = false
- const i18n = new VueI18n({
- locale: 'en-US',
- messages: {
- 'en-US': {
- index: {
- invite: 'Invite',
- game: 'Game'
- }
- },
- 'zh-CN': {
- index: {
- invite: '邀请',
- game: '游戏'
- }
- }
- }
- })
- Vue.prototype._i18n = i18n
- App.mpType = 'app'
- const app = new Vue({
- i18n,
- ...App
- })
- app.$mount()
- <template>
- <view class="uni-content">
- <text>{{ i18n.invite }}</text>
- <text>{{ i18n.game }}</text>
- </view>
- </template>
- <script>
- export default {
- computed: {
- i18n () {
- return this.$t('index')
- }
- }
- }
- </script>
- <style>
- </style>