diff --git a/src/action-bar/demo/index.vue b/src/action-bar/demo/index.vue index 86cfd3e13..c661d79e7 100644 --- a/src/action-bar/demo/index.vue +++ b/src/action-bar/demo/index.vue @@ -2,7 +2,7 @@ import { useTranslate } from '@demo/use-translate'; import { Toast } from '../../toast'; -const i18n = { +const t = useTranslate({ 'zh-CN': { icon1: '客服', icon2: '购物车', @@ -29,9 +29,7 @@ const i18n = { customIconColor: 'Custom Icon Color', customButtonColor: 'Custom Button Color', }, -}; - -const t = useTranslate(i18n); +}); const onClickIcon = () => Toast(t('clickIcon')); const onClickButton = () => Toast(t('clickButton')); diff --git a/src/action-sheet/demo/index.vue b/src/action-sheet/demo/index.vue index 64ba73ab5..9d4f03bfe 100644 --- a/src/action-sheet/demo/index.vue +++ b/src/action-sheet/demo/index.vue @@ -4,7 +4,7 @@ import { useTranslate } from '@demo/use-translate'; import { ActionSheetAction } from '..'; import { Toast } from '../../toast'; -const i18n = { +const t = useTranslate({ 'zh-CN': { option1: '选项一', option2: '选项二', @@ -33,9 +33,7 @@ const i18n = { disabledOption: 'Disabled Option', showDescription: 'Show Description', }, -}; - -const t = useTranslate(i18n); +}); const showBasic = ref(false); const showCancel = ref(false); const showTitle = ref(false); diff --git a/src/address-edit/demo/index.vue b/src/address-edit/demo/index.vue index ce3a676b3..469988211 100644 --- a/src/address-edit/demo/index.vue +++ b/src/address-edit/demo/index.vue @@ -4,7 +4,7 @@ import { areaList } from '@vant/area-data'; import { useTranslate } from '@demo/use-translate'; import { Toast } from '../../toast'; -const i18n = { +const t = useTranslate({ 'zh-CN': { areaColumnsPlaceholder: ['请选择', '请选择', '请选择'], searchResult: [ @@ -37,9 +37,7 @@ const i18n = { }, ], }, -}; - -const t = useTranslate(i18n); +}); const searchResult = ref([]); const onSave = () => Toast(t('save')); diff --git a/src/address-list/demo/index.vue b/src/address-list/demo/index.vue index f59a9a726..a641bfcd1 100644 --- a/src/address-list/demo/index.vue +++ b/src/address-list/demo/index.vue @@ -3,7 +3,7 @@ import { ref } from 'vue'; import { useTranslate } from '@demo/use-translate'; import { Toast } from '../../toast'; -const i18n = { +const t = useTranslate({ 'zh-CN': { list: [ { @@ -62,9 +62,8 @@ const i18n = { disabledText: 'The following address is out of range', defaultTagText: 'Default', }, -}; +}); -const t = useTranslate(i18n); const chosenAddressId = ref('1'); const onAdd = () => { Toast(t('add')); diff --git a/src/area/demo/index.vue b/src/area/demo/index.vue index 809eb67b7..fa40d6a48 100644 --- a/src/area/demo/index.vue +++ b/src/area/demo/index.vue @@ -4,7 +4,7 @@ import { areaList } from '@vant/area-data'; import { areaListEn } from './area-en'; import { useTranslate } from '@demo/use-translate'; -const i18n = { +const t = useTranslate({ 'zh-CN': { title2: '选中省市区', title3: '配置显示列', @@ -19,9 +19,8 @@ const i18n = { columnsPlaceholder: ['Choose', 'Choose', 'Choose'], areaList: areaListEn, }, -}; +}); -const t = useTranslate(i18n); const value = ref('330302'); diff --git a/src/badge/demo/index.vue b/src/badge/demo/index.vue index dd9ff74ae..0c76277af 100644 --- a/src/badge/demo/index.vue +++ b/src/badge/demo/index.vue @@ -1,7 +1,7 @@