Revert "fix(i18n): 修复微信小程序国际化问题"
This reverts commit c970e7bee176d250c795f8147b5ef2e394b29f2a.
This commit is contained in:
parent
92da043dd2
commit
b616ad6070
17
src/App.vue
17
src/App.vue
@ -1,25 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import { tabBar } from '@/pages.json'
|
|
||||||
|
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
const setTabbarText = () => {
|
|
||||||
const { t } = useI18n()
|
|
||||||
const tabbarTexts = tabBar.list.map((item) => item.text.replace(/(^%|%$)/g, ''))
|
|
||||||
tabbarTexts.forEach((transKey: string, index: number) => {
|
|
||||||
uni.setTabBarItem({
|
|
||||||
index,
|
|
||||||
text: t(transKey),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// fix 微信小程序需要手动调用 api 设置一次国际化tabbar text。
|
|
||||||
setTabbarText()
|
|
||||||
uni.onLocaleChange(setTabbarText)
|
|
||||||
// #endif
|
|
||||||
})
|
})
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
|
@ -44,16 +44,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import i18n, { t } from '@/locale/index'
|
import i18n, { t } from '@/locale/index'
|
||||||
import { testI18n } from '@/utils/i18n'
|
import { testI18n } from '@/utils/i18n'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
onLoad(() => {
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
// fix 微信小程序需要手动调用 api 设置一次国际化标题。
|
|
||||||
uni.setNavigationBarTitle({ title: t('app.name') })
|
|
||||||
// #endif
|
|
||||||
})
|
|
||||||
|
|
||||||
const current = ref(uni.getLocale())
|
const current = ref(uni.getLocale())
|
||||||
const user = { name: '张三', detail: { height: 178, weight: '75kg' } }
|
const user = { name: '张三', detail: { height: 178, weight: '75kg' } }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user