docs: improve demo translating

This commit is contained in:
chenjiahan
2020-12-11 10:07:07 +08:00
parent b3dfb4997f
commit 09858eb1d3
15 changed files with 281 additions and 248 deletions
+23 -22
View File
@@ -53,33 +53,33 @@
<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': {
label: '地址',
disabled: '禁用搜索框',
inputAlign: '搜索框内容对齐',
background: '自定义背景色',
placeholder: '请输入搜索关键词',
customButton: '自定义按钮',
listenToEvents: '事件监听',
},
'en-US': {
label: 'Address',
disabled: 'Disabled',
inputAlign: 'Input Align',
background: 'Custom Background Color',
placeholder: 'Placeholder',
customButton: 'Custom Action Button',
listenToEvents: 'Listen to Events',
},
const i18n = {
'zh-CN': {
label: '地址',
disabled: '禁用搜索框',
inputAlign: '搜索框内容对齐',
background: '自定义背景色',
placeholder: '请输入搜索关键词',
customButton: '自定义按钮',
listenToEvents: '事件监听',
},
'en-US': {
label: 'Address',
disabled: 'Disabled',
inputAlign: 'Input Align',
background: 'Custom Background Color',
placeholder: 'Placeholder',
customButton: 'Custom Action Button',
listenToEvents: 'Listen to Events',
},
};
export default {
setup() {
const t = useTranslate();
const t = useTranslate(i18n);
const state = reactive({
value1: '',
value2: '',
@@ -99,6 +99,7 @@ export default {
return {
...toRefs(state),
t,
onSearch,
onCancel,
};