docs(Field): update i18n usage
This commit is contained in:
+20
-15
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user