feat(i18n): 支持参数传递
This commit is contained in:
parent
6362422f5a
commit
7a3edaf816
4
src/i18n.d.ts
vendored
4
src/i18n.d.ts
vendored
@ -3,7 +3,7 @@ export {}
|
||||
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
$t: (key: string) => string
|
||||
$tm: (key: string) => [] | { [p: string]: any }
|
||||
$t: (key: string, opt?: Record<string, any>) => string
|
||||
$tm: (key: string, opt?: Record<string, any>) => [] | { [p: string]: any }
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"weight": "{heavy}KG",
|
||||
"app.name": "En Title"
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"app.name": "中文标题"
|
||||
"app.name": "中文标题",
|
||||
"weight": "{heavy}公斤"
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
<view class="center flex-col mt-6">
|
||||
<view class="text-green-500">多语言测试</view>
|
||||
<view class="m-4">{{ $t('app.name') }}</view>
|
||||
<view class="m-4">{{ $t('weight', { heavy: 100 }) }}</view>
|
||||
|
||||
<view class="text-green-500 mt-12">切换语言 </view>
|
||||
<view class="uni-list">
|
||||
|
Loading…
x
Reference in New Issue
Block a user