Skip to content

Commit 4f4dcfe

Browse files
committed
refactor: normalize i18n usage (JS:t, template:$t)
1 parent 6b71b6f commit 4f4dcfe

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

src/components/TabBar.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<script setup lang="ts">
22
import { routeWhiteList } from '@/config/routes'
33
4-
const { t } = useI18n()
54
const active = ref(0)
65
const route = useRoute()
76
87
const show = computed(() => route.name && routeWhiteList.includes(route.name))
98
</script>
109

1110
<template>
12-
<van-tabbar v-if="show" v-model="active" placeholder route>
11+
<van-tabbar v-if="show" v-model="active" route placeholder>
1312
<van-tabbar-item replace to="/">
14-
{{ t('layouts.home') }}
13+
{{ $t('layouts.home') }}
1514
<template #icon>
1615
<div class="i-carbon:home" />
1716
</template>
1817
</van-tabbar-item>
1918
<van-tabbar-item replace to="/profile">
20-
{{ t('layouts.profile') }}
19+
{{ $t('layouts.profile') }}
2120
<template #icon>
2221
<div class="i-carbon:user" />
2322
</template>

src/pages/forgot-password/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async function getCode() {
8080
v-model.trim="postData.email"
8181
:rules="rules.email"
8282
name="email"
83-
:placeholder="t('forgot-password.email')"
83+
:placeholder="$t('forgot-password.email')"
8484
/>
8585
</div>
8686

@@ -89,7 +89,7 @@ async function getCode() {
8989
v-model.trim="postData.code"
9090
:rules="rules.code"
9191
name="code"
92-
:placeholder="t('forgot-password.code')"
92+
:placeholder="$t('forgot-password.code')"
9393
>
9494
<template #button>
9595
<van-button size="small" type="primary" plain @click="getCode">
@@ -105,7 +105,7 @@ async function getCode() {
105105
type="password"
106106
:rules="rules.password"
107107
name="password"
108-
:placeholder="t('forgot-password.password')"
108+
:placeholder="$t('forgot-password.password')"
109109
/>
110110
</div>
111111

@@ -115,7 +115,7 @@ async function getCode() {
115115
type="password"
116116
:rules="rules.confirmPassword"
117117
name="confirmPassword"
118-
:placeholder="t('forgot-password.comfirmPassword')"
118+
:placeholder="$t('forgot-password.comfirmPassword')"
119119
/>
120120
</div>
121121

src/pages/login/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async function login(values: any) {
6565
v-model="postData.email"
6666
:rules="rules.email"
6767
name="email"
68-
:placeholder="t('login.email')"
68+
:placeholder="$t('login.email')"
6969
/>
7070
</div>
7171

@@ -75,7 +75,7 @@ async function login(values: any) {
7575
type="password"
7676
:rules="rules.password"
7777
name="password"
78-
:placeholder="t('login.password')"
78+
:placeholder="$t('login.password')"
7979
/>
8080
</div>
8181

src/pages/register/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function getCode() {
8484
v-model.trim="postData.email"
8585
:rules="rules.email"
8686
name="email"
87-
:placeholder="t('register.email')"
87+
:placeholder="$t('register.email')"
8888
/>
8989
</div>
9090

@@ -93,7 +93,7 @@ async function getCode() {
9393
v-model.trim="postData.code"
9494
:rules="rules.code"
9595
name="code"
96-
:placeholder="t('register.code')"
96+
:placeholder="$t('register.code')"
9797
>
9898
<template #button>
9999
<van-button size="small" type="primary" plain @click="getCode">
@@ -108,7 +108,7 @@ async function getCode() {
108108
v-model.trim="postData.nickname"
109109
:rules="rules.nickname"
110110
name="nickname"
111-
:placeholder="t('register.nickname')"
111+
:placeholder="$t('register.nickname')"
112112
/>
113113
</div>
114114

@@ -118,7 +118,7 @@ async function getCode() {
118118
type="password"
119119
:rules="rules.password"
120120
name="password"
121-
:placeholder="t('register.password')"
121+
:placeholder="$t('register.password')"
122122
/>
123123
</div>
124124

@@ -128,7 +128,7 @@ async function getCode() {
128128
type="password"
129129
:rules="rules.confirmPassword"
130130
name="confirmPassword"
131-
:placeholder="t('register.comfirmPassword')"
131+
:placeholder="$t('register.comfirmPassword')"
132132
/>
133133
</div>
134134

src/pages/scroll-cache/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defineOptions({
66
const list = ref([])
77
const loading = ref(false)
88
const finished = ref(false)
9-
const { t } = useI18n()
109
1110
function onLoad() {
1211
setTimeout(() => {
@@ -51,7 +50,7 @@ onBeforeRouteLeave(() => {
5150
class="mb-8 rounded-12"
5251
>
5352
<template #title>
54-
{{ t('scrollCache.listItem') }}
53+
{{ $t('scrollCache.listItem') }}
5554
</template>
5655

5756
<template #value>

0 commit comments

Comments
 (0)