refactor: demo using script setup (#9235)

This commit is contained in:
neverland
2021-08-11 10:55:10 +08:00
committed by GitHub
parent 010238b63c
commit 4c41908ac1
86 changed files with 4277 additions and 5151 deletions
+21 -26
View File
@@ -1,3 +1,24 @@
<script setup lang="ts">
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
max: '最大值',
standalone: '独立展示',
customColor: '自定义颜色',
customContent: '自定义徽标内容',
},
'en-US': {
max: 'Max',
standalone: 'Standalone',
customColor: 'Custom Color',
customContent: 'Custom Content',
},
};
const t = useTranslate(i18n);
</script>
<template>
<demo-block :title="t('basicUsage')">
<van-badge content="5">
@@ -65,32 +86,6 @@
</demo-block>
</template>
<script lang="ts">
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
max: '最大值',
standalone: '独立展示',
customColor: '自定义颜色',
customContent: '自定义徽标内容',
},
'en-US': {
max: 'Max',
standalone: 'Standalone',
customColor: 'Custom Color',
customContent: 'Custom Content',
},
};
export default {
setup() {
const t = useTranslate(i18n);
return { t };
},
};
</script>
<style lang="less">
@import '../../style/var';