docs(Field): update i18n usage

This commit is contained in:
chenjiahan
2020-12-13 14:56:13 +08:00
parent 3452ee2a41
commit 65e14cd84a
10 changed files with 208 additions and 168 deletions
+20 -15
View File
@@ -17,30 +17,35 @@
</demo-block>
</template>
<script>
<script lang="ts">
import { reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
text: '文本',
showIcon: '显示图标',
showClearIcon: '显示清除图标',
},
'en-US': {
text: 'Text',
showIcon: 'Show Icon',
showClearIcon: 'Show Clear Icon',
},
};
export default {
i18n: {
'zh-CN': {
text: '文本',
showIcon: '显示图标',
showClearIcon: '显示清除图标',
},
'en-US': {
text: 'Text',
showIcon: 'Show Icon',
showClearIcon: 'Show Clear Icon',
},
},
setup() {
const t = useTranslate(i18n);
const state = reactive({
icon1: '',
icon2: '123',
});
return toRefs(state);
return {
...toRefs(state),
t,
};
},
};
</script>