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
+18 -28
View File
@@ -1,3 +1,21 @@
<script setup lang="ts">
import { useTranslate } from '@demo/use-translate';
import { Toast } from '../../toast';
const i18n = {
'zh-CN': {
useSlot: '使用插槽',
},
'en-US': {
useSlot: 'Use Slot',
},
};
const t = useTranslate(i18n);
const onClickLeft = () => Toast(t('back'));
const onClickRight = () => Toast(t('button'));
</script>
<template>
<demo-block :title="t('basicUsage')">
<van-nav-bar
@@ -18,31 +36,3 @@
</van-nav-bar>
</demo-block>
</template>
<script lang="ts">
import { useTranslate } from '@demo/use-translate';
import { Toast } from '../../toast';
const i18n = {
'zh-CN': {
useSlot: '使用插槽',
},
'en-US': {
useSlot: 'Use Slot',
},
};
export default {
setup() {
const t = useTranslate(i18n);
const onClickLeft = () => Toast(t('back'));
const onClickRight = () => Toast(t('button'));
return {
t,
onClickLeft,
onClickRight,
};
},
};
</script>