docs(Card): use composition api

This commit is contained in:
chenjiahan
2020-12-13 12:37:49 +08:00
parent 7d2678764c
commit e4eb2d07d7
+21 -18
View File
@@ -31,12 +31,10 @@
> >
<template #tags> <template #tags>
<div> <div>
<van-tag plain type="danger" style="margin-right: 5px;"> <van-tag plain type="danger" style="margin-right: 5px">
标签 {{ t('tag') }}
</van-tag>
<van-tag plain type="danger">
标签
</van-tag> </van-tag>
<van-tag plain type="danger">{{ t('tag') }}</van-tag>
</div> </div>
</template> </template>
@@ -54,22 +52,27 @@
</demo-block> </demo-block>
</template> </template>
<script> <script lang="ts">
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
title: '商品名称',
discountInfo: '营销信息',
customContent: '自定义内容',
},
'en-US': {
discountInfo: 'Discount Info',
customContent: 'Custom Content',
},
};
export default { export default {
i18n: { setup() {
'zh-CN': { const t = useTranslate(i18n);
title: '商品名称',
discountInfo: '营销信息',
customContent: '自定义内容',
},
'en-US': {
discountInfo: 'Discount Info',
customContent: 'Custom Content',
},
},
data() {
return { return {
t,
imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg', imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg',
}; };
}, },