docs(Card): use composition api

This commit is contained in:
chenjiahan 2020-12-13 12:37:49 +08:00
parent 7d2678764c
commit e4eb2d07d7

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">
export default { import { useTranslate } from '@demo/use-translate';
i18n: {
'zh-CN': { const i18n = {
title: '商品名称', 'zh-CN': {
discountInfo: '营销信息', title: '商品名称',
customContent: '自定义内容', discountInfo: '营销信息',
}, customContent: '自定义内容',
'en-US': { },
discountInfo: 'Discount Info', 'en-US': {
customContent: 'Custom Content', discountInfo: 'Discount Info',
}, customContent: 'Custom Content',
}, },
};
export default {
setup() {
const t = useTranslate(i18n);
data() {
return { return {
t,
imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg', imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg',
}; };
}, },