main.ts文件
app.use(i18n)
js中使用
<script setup lang="ts">
import { getCurrentInstance, ComponentInternalInstance } from "vue"
const { appContext } = getCurrentInstance() as ComponentInternalInstance
let msg = appContext.config.globalProperties.$t("message")
console.log(msg)
</script>
模板中使用
<div>{{$t('message')}}</div>
<el-input v-model="value" :placeholder="$t('inputPlaceholder')" />