ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] > https://kazupon.github.io/vue-i18n/zh/introduction.html ## 概述 ## 安装 ``` yarn add vue-i18n ``` ## 快速入门 ``` import { createApp } from 'vue' import { createI18n } from 'vue-i18n' import App from './App.vue' const messages = { en: { // 英文语言环境 hello: 'Hello', world: 'World' }, zh: { // 中文语言环境 hello: '你好', world: '世界' } } const i18n = createI18n({ locale: 'en', // 设置默认语言环境 messages // 设置语言环境消息 }) createApp(App).use(i18n).mount('#app') ``` 使用 ``` <template> <div> <p>{{ $t('hello') }} {{ $t('world') }}</p> </div> </template> ```