feat(i18n): 移除国际化
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
<script lang="tsx" setup>
|
||||
import I18nComp from '../components/i18nComp.vue';
|
||||
|
||||
useHead({
|
||||
// Titles
|
||||
title: 'Hello World',
|
||||
@ -14,23 +16,9 @@ definePage({
|
||||
alias: '/',
|
||||
});
|
||||
|
||||
import type { FunctionalComponent } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { locale, t } = useI18n({
|
||||
messages: {
|
||||
en: {
|
||||
message: 'This is an important message!',
|
||||
},
|
||||
zh: {
|
||||
message: '这是一条重要消息!',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// https://cn.vuejs.org/guide/extras/render-function#typing-functional-components
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
|
||||
const FComponent: import('vue').FunctionalComponent<{ prop: string }> = (props, context) => (
|
||||
// <>
|
||||
<div border="1 solid pink" text="pink">
|
||||
<span>This is a functional component with prop: {JSON.stringify(props)}</span>
|
||||
@ -50,13 +38,7 @@ const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
|
||||
</ul>
|
||||
|
||||
<div b="1px solid pink" mt-8>
|
||||
<select v-model="locale">
|
||||
<option value="zh">中文</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
<h1>{{ $t('welcome') }}</h1>
|
||||
<p>{{ $t('hello', { name: 'John' }) }}</p>
|
||||
<p class="message">{{ t('message') }}</p>
|
||||
<I18nComp />
|
||||
</div>
|
||||
|
||||
<FComponent prop="Hello World" style="margin-top: 8px"></FComponent>
|
||||
|
Reference in New Issue
Block a user