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 -30
View File
@@ -1,3 +1,24 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
offsetTop: '吸顶距离',
offsetBottom: '吸底距离',
setContainer: '指定容器',
},
'en-US': {
offsetTop: 'Offset Top',
offsetBottom: 'Offset Bottom',
setContainer: 'Set Container',
},
};
const t = useTranslate(i18n);
const container = ref(null);
</script>
<template>
<demo-block :title="t('basicUsage')">
<van-sticky>
@@ -35,36 +56,6 @@
</demo-block>
</template>
<script lang="ts">
import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
offsetTop: '吸顶距离',
offsetBottom: '吸底距离',
setContainer: '指定容器',
},
'en-US': {
offsetTop: 'Offset Top',
offsetBottom: 'Offset Bottom',
setContainer: 'Set Container',
},
};
export default {
setup() {
const t = useTranslate(i18n);
const container = ref(null);
return {
t,
container,
};
},
};
</script>
<style lang="less">
@import '../../style/var';