refactor: demo using script setup (#9235)
This commit is contained in:
+23
-28
@@ -1,3 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { useTranslate } from '@demo/use-translate';
|
||||
|
||||
const i18n = {
|
||||
'zh-CN': {
|
||||
text: '文本',
|
||||
dashed: '虚线',
|
||||
withText: '展示文本',
|
||||
contentPosition: '内容位置',
|
||||
customStyle: '自定义样式',
|
||||
},
|
||||
'en-US': {
|
||||
text: 'Text',
|
||||
dashed: 'Dashed',
|
||||
withText: 'With Text',
|
||||
contentPosition: 'Content Position',
|
||||
customStyle: 'Custom Style',
|
||||
},
|
||||
};
|
||||
|
||||
const t = useTranslate(i18n);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<demo-block :title="t('basicUsage')">
|
||||
<van-divider />
|
||||
@@ -34,34 +57,6 @@
|
||||
</demo-block>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { useTranslate } from '@demo/use-translate';
|
||||
|
||||
const i18n = {
|
||||
'zh-CN': {
|
||||
text: '文本',
|
||||
dashed: '虚线',
|
||||
withText: '展示文本',
|
||||
contentPosition: '内容位置',
|
||||
customStyle: '自定义样式',
|
||||
},
|
||||
'en-US': {
|
||||
text: 'Text',
|
||||
dashed: 'Dashed',
|
||||
withText: 'With Text',
|
||||
contentPosition: 'Content Position',
|
||||
customStyle: 'Custom Style',
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const t = useTranslate(i18n);
|
||||
return { t };
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import '../../style/var';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user