From 8cb73bf5049309752e85deeadd815b5592234849 Mon Sep 17 00:00:00 2001 From: cunzaizhuyi <877824709@qq.com> Date: Sun, 18 Jun 2023 21:23:28 +0800 Subject: [PATCH] docs(Button): add animated button demo (#11995) * chore(Button): add animation button demo * fix: npm run test * chore(Button): modify text * chore: add space --- packages/vant/src/button/README.md | 24 ++++++++++++++ packages/vant/src/button/README.zh-CN.md | 26 +++++++++++++++ packages/vant/src/button/demo/index.vue | 27 ++++++++++++++++ .../test/__snapshots__/demo-ssr.spec.ts.snap | 32 +++++++++++++++++++ .../test/__snapshots__/demo.spec.ts.snap | 26 +++++++++++++++ 5 files changed, 135 insertions(+) diff --git a/packages/vant/src/button/README.md b/packages/vant/src/button/README.md index d0613e80b..8af1334c0 100644 --- a/packages/vant/src/button/README.md +++ b/packages/vant/src/button/README.md @@ -109,6 +109,30 @@ app.use(Button); ``` +### Animated Button + +```html + + + Do Task + Lottery + + + + +``` + ## API ### Props diff --git a/packages/vant/src/button/README.zh-CN.md b/packages/vant/src/button/README.zh-CN.md index c043350a6..b5884d886 100644 --- a/packages/vant/src/button/README.zh-CN.md +++ b/packages/vant/src/button/README.zh-CN.md @@ -131,6 +131,32 @@ app.use(Button); ``` +### 动画按钮 + +搭配 Button 和 Swipe 组件,可以实现垂直滚动的动画按钮效果。 + +```html + + + 做任务 + 抽大奖 + + + + +``` + ## API ### Props diff --git a/packages/vant/src/button/demo/index.vue b/packages/vant/src/button/demo/index.vue index 12646da33..304dc2582 100644 --- a/packages/vant/src/button/demo/index.vue +++ b/packages/vant/src/button/demo/index.vue @@ -1,5 +1,7 @@ @@ -140,6 +148,21 @@ const t = useTranslate({ :text="t('gradient')" /> + + + + + {{ t('doTask') }} + {{ t('lottery') }} + + + diff --git a/packages/vant/src/button/test/__snapshots__/demo-ssr.spec.ts.snap b/packages/vant/src/button/test/__snapshots__/demo-ssr.spec.ts.snap index 1b44259cb..eeb36e2ab 100644 --- a/packages/vant/src/button/test/__snapshots__/demo-ssr.spec.ts.snap +++ b/packages/vant/src/button/test/__snapshots__/demo-ssr.spec.ts.snap @@ -420,4 +420,36 @@ exports[`should render demo and match snapshot 1`] = ` +
+ + +
`; diff --git a/packages/vant/src/button/test/__snapshots__/demo.spec.ts.snap b/packages/vant/src/button/test/__snapshots__/demo.spec.ts.snap index 0967a18c3..55156b822 100644 --- a/packages/vant/src/button/test/__snapshots__/demo.spec.ts.snap +++ b/packages/vant/src/button/test/__snapshots__/demo.spec.ts.snap @@ -356,4 +356,30 @@ exports[`should render demo and match snapshot 1`] = ` +
+ +
`;