From b558db309364ccc12c8e4bfd06c48c7c2eeedc47 Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 22 Oct 2021 15:27:00 +0800 Subject: [PATCH] feat(Progress): add --van-progress-inactive-color var (#9711) * feat(Progress): add --van-progress-inactive-color var * fix: doc --- packages/vant/src/progress/Progress.tsx | 12 +++++++++--- packages/vant/src/progress/README.md | 1 + packages/vant/src/progress/README.zh-CN.md | 1 + packages/vant/src/progress/demo/index.vue | 2 +- packages/vant/src/progress/index.less | 9 +++++++++ .../progress/test/__snapshots__/demo.spec.ts.snap | 12 ++++++------ packages/vant/src/progress/var.less | 1 + 7 files changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/vant/src/progress/Progress.tsx b/packages/vant/src/progress/Progress.tsx index 1b780e18c..20ab46e42 100644 --- a/packages/vant/src/progress/Progress.tsx +++ b/packages/vant/src/progress/Progress.tsx @@ -28,7 +28,7 @@ export default defineComponent({ setup(props) { const background = computed(() => - props.inactive ? '#cacaca' : props.color + props.inactive ? undefined : props.color ); const renderPivot = () => { @@ -44,7 +44,10 @@ export default defineComponent({ }; return ( - + {text} ); @@ -64,7 +67,10 @@ export default defineComponent({ return (
- + {renderPivot()}
); diff --git a/packages/vant/src/progress/README.md b/packages/vant/src/progress/README.md index 331d90a1c..7096975d7 100644 --- a/packages/vant/src/progress/README.md +++ b/packages/vant/src/progress/README.md @@ -98,6 +98,7 @@ The component provides the following CSS variables, which can be used to customi | --- | --- | --- | | --van-progress-height | _4px_ | - | | --van-progress-color | _var(--van-primary-color)_ | - | +| --van-progress-inactive-color | _var(--van-gray-5)_ | - | | --van-progress-background-color | _var(--van-gray-3)_ | - | | --van-progress-pivot-padding | _0 5px_ | - | | --van-progress-pivot-text-color | _var(--van-white)_ | - | diff --git a/packages/vant/src/progress/README.zh-CN.md b/packages/vant/src/progress/README.zh-CN.md index 127065e49..973093eca 100644 --- a/packages/vant/src/progress/README.zh-CN.md +++ b/packages/vant/src/progress/README.zh-CN.md @@ -102,6 +102,7 @@ progressRef.value?.resize(); | ------------------------------------- | -------------------------- | ---- | | --van-progress-height | _4px_ | - | | --van-progress-color | _var(--van-primary-color)_ | - | +| --van-progress-inactive-color | _var(--van-gray-5)_ | - | | --van-progress-background-color | _var(--van-gray-3)_ | - | | --van-progress-pivot-padding | _0 5px_ | - | | --van-progress-pivot-text-color | _var(--van-white)_ | - | diff --git a/packages/vant/src/progress/demo/index.vue b/packages/vant/src/progress/demo/index.vue index 81729969d..7deda273a 100644 --- a/packages/vant/src/progress/demo/index.vue +++ b/packages/vant/src/progress/demo/index.vue @@ -57,7 +57,7 @@ const reduce = () => { - +
- - 50% @@ -80,10 +80,10 @@ exports[`should render demo and match snapshot 1`] = `
- 50% diff --git a/packages/vant/src/progress/var.less b/packages/vant/src/progress/var.less index 6aa504372..b36bf94d2 100644 --- a/packages/vant/src/progress/var.less +++ b/packages/vant/src/progress/var.less @@ -2,6 +2,7 @@ @progress-height: 4px; @progress-color: var(--van-primary-color); +@progress-inactive-color: var(--van-gray-5); @progress-background-color: var(--van-gray-3); @progress-pivot-padding: 0 5px; @progress-pivot-text-color: var(--van-white);