mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
docs: improve demo translating
This commit is contained in:
@@ -52,37 +52,37 @@
|
||||
|
||||
<script>
|
||||
import { reactive, toRefs } from 'vue';
|
||||
import { useTranslate } from '../../composables/use-translate';
|
||||
import { useTranslate } from '@demo/use-translate';
|
||||
import Toast from '../../toast';
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
'zh-CN': {
|
||||
text: '当前值:',
|
||||
title1: '基础用法',
|
||||
title2: '双滑块',
|
||||
title3: '指定选择范围',
|
||||
title4: '禁用',
|
||||
title5: '指定步长',
|
||||
vertical: '垂直方向',
|
||||
customStyle: '自定义样式',
|
||||
customButton: '自定义按钮',
|
||||
},
|
||||
'en-US': {
|
||||
text: 'Current value: ',
|
||||
title1: 'Basic Usage',
|
||||
title2: 'Dual thumb mode',
|
||||
title3: 'Range',
|
||||
title4: 'Disabled',
|
||||
title5: 'Step size',
|
||||
vertical: 'Vertical',
|
||||
customStyle: 'Custom Style',
|
||||
customButton: 'Custom Button',
|
||||
},
|
||||
const i18n = {
|
||||
'zh-CN': {
|
||||
text: '当前值:',
|
||||
title1: '基础用法',
|
||||
title2: '双滑块',
|
||||
title3: '指定选择范围',
|
||||
title4: '禁用',
|
||||
title5: '指定步长',
|
||||
vertical: '垂直方向',
|
||||
customStyle: '自定义样式',
|
||||
customButton: '自定义按钮',
|
||||
},
|
||||
'en-US': {
|
||||
text: 'Current value: ',
|
||||
title1: 'Basic Usage',
|
||||
title2: 'Dual thumb mode',
|
||||
title3: 'Range',
|
||||
title4: 'Disabled',
|
||||
title5: 'Step size',
|
||||
vertical: 'Vertical',
|
||||
customStyle: 'Custom Style',
|
||||
customButton: 'Custom Button',
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const t = useTranslate();
|
||||
const t = useTranslate(i18n);
|
||||
const state = reactive({
|
||||
value1: 50,
|
||||
value2: [20, 60],
|
||||
@@ -101,6 +101,7 @@ export default {
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
t,
|
||||
onChange,
|
||||
};
|
||||
},
|
||||
|
Reference in New Issue
Block a user