feat: 添加 primelocale 依赖并更新 PrimeVue 组件以支持多语言选择
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 1m54s
/ depcheck (push) Has been cancelled
/ playwright (push) Has been cancelled

This commit is contained in:
严浩
2024-11-22 16:11:41 +08:00
parent e39fea979d
commit f708970fa4
4 changed files with 24 additions and 4 deletions

View File

@ -29,6 +29,7 @@
<select id="locale" v-model="$i18n.locale">
<option v-for="locale in $i18n.availableLocales" :key="locale" :value="locale">{{ locale }}</option>
</select>
<p>$i18n.locale: {{ $i18n.locale }}</p>
</form>
</div>
</template>

View File

@ -1,9 +1,14 @@
<script setup lang="ts">
import { usePrimeVue } from 'primevue/config';
import zhCN from 'primelocale/zh-CN.json';
const primevue = usePrimeVue();
primevue.config.locale = zhCN['zh-CN'];
</script>
<template>
<div class="pppppppp">
<InputText />
<Button>PButton</Button>
<Select
:options="[
{ name: 'New York', code: 'NY' },
@ -13,8 +18,12 @@
{ name: 'Paris', code: 'PRS' },
]"
optionLabel="name"
placeholder="Select a City"
placeholder="选择城市"
class="min-w-[200px]"
/>
<DatePicker dateFormat="dd/mm/yy" />
<Button>PButton</Button>
</div>
</template>