diff --git a/packages/varlet-ui/src/progress/Progress.vue b/packages/varlet-ui/src/progress/Progress.vue
index e316451e0c6..1ec960a43b1 100644
--- a/packages/varlet-ui/src/progress/Progress.vue
+++ b/packages/varlet-ui/src/progress/Progress.vue
@@ -6,13 +6,13 @@
:style="{ height: toSizeUnit(lineWidth), background: trackColor }"
>
@@ -27,33 +27,41 @@
:class="classes(n('circle'), [indeterminate, n('circle-indeterminate')])"
:style="{ width: toSizeUnit(size), height: toSizeUnit(size) }"
>
-
@@ -68,7 +76,8 @@
@@ -39,11 +39,17 @@ Display the current progress of an operation flow.
Set the line width, progress bar color and track color through the attributes of `type`, `line-width`, `color`, `track-color`.
```html
+
+
-
+
```
@@ -52,25 +58,30 @@ Set the line width, progress bar color and track color through the attributes of
```html
+
@@ -108,7 +119,7 @@ Enable indeterminate animation through the `indeterminate` attribute when loadin
| `type` | Progress type, Can be set to `default` `primary` `info` `success` `warning` `danger` | _string_ | `primary` |
| `value` | Completion value | _string \| number_ | `0` |
| `line-width` | Width of the progress bar | _string \| number_ | `4` |
-| `color` | Color of the progress bar | _string_ | `#005CAF` |
+| `color` | Color of the progress bar (The circular progress bar sets the gradient color, please use object) | _string \| object_ | `-` |
| `track-color` | Color of the progress track | _string_ | `#d8d8d8` |
| `label` | Whether the label is visible or not | _boolean_ | `false` |
| `label-class` | Custom label class name | _string_ | `-` |
diff --git a/packages/varlet-ui/src/progress/docs/zh-CN.md b/packages/varlet-ui/src/progress/docs/zh-CN.md
index 4dffc9467b1..ba6a0ab294f 100644
--- a/packages/varlet-ui/src/progress/docs/zh-CN.md
+++ b/packages/varlet-ui/src/progress/docs/zh-CN.md
@@ -39,8 +39,14 @@ onUnmounted(() => {
通过 `type`、`line-width`、`color`、`track-color` 属性设置线宽、进度条颜色、轨道颜色。
```html
+
+
@@ -56,6 +62,10 @@ import { ref, onMounted, onUnmounted } from 'vue'
const value = ref(0)
const interval = ref(0)
+const gradientColor = ref({
+ '0%': '#3fecff',
+ '100%': '#6149f6',
+})
onMounted(() => {
interval.value = window.setInterval(() => {
@@ -71,6 +81,7 @@ onUnmounted(() => {
+
@@ -108,7 +119,7 @@ onUnmounted(() => {
| `type` | 类型,可选值为 `default` `primary` `info` `success` `warning` `danger` | _string_ | `primary` |
| `value` | `progress` 的进度 | _string \| number_ | `0` |
| `line-width` | `progress` 的线宽 | _string \| number_ | `4` |
-| `color` | `progress` 的颜色 | _string_ | `#005CAF` |
+| `color` | `progress` 的颜色 (环形进度条设置渐变色请使用object) | _string \| object_ | `-` |
| `track-color` | `progress` 轨道的颜色 | _string_ | `#d8d8d8` |
| `label` | 是否显示 `label` | _boolean_ | `false` |
| `label-class` | 自定义 `label` 的类名 | _string_ | `-` |
diff --git a/packages/varlet-ui/src/progress/example/index.vue b/packages/varlet-ui/src/progress/example/index.vue
index 8d6a9222543..3a239b979e6 100644
--- a/packages/varlet-ui/src/progress/example/index.vue
+++ b/packages/varlet-ui/src/progress/example/index.vue
@@ -8,6 +8,11 @@ import { pack, use } from './locale'
const value = ref(0)
const interval = ref(0)
+const circleGradientColor = ref({
+ '0%': '#3fecff',
+ '100%': '#6149f6',
+})
+const linearGradientColor = ref('linear-gradient(131.53deg, #3fecff 0%, #6149f6 100%)')
onMounted(() => {
interval.value = window.setInterval(() => {
@@ -34,6 +39,7 @@ onUnmounted(() => {
{{ pack.style }}
+
@@ -41,6 +47,7 @@ onUnmounted(() => {
{{ pack.circle }}
+
success
diff --git a/packages/varlet-ui/src/progress/props.ts b/packages/varlet-ui/src/progress/props.ts
index ce242371c64..43da230b577 100644
--- a/packages/varlet-ui/src/progress/props.ts
+++ b/packages/varlet-ui/src/progress/props.ts
@@ -13,7 +13,7 @@ export const props = {
type: [Number, String],
default: 4,
},
- color: String,
+ color: [String, Object] as PropType>,
trackColor: String,
ripple: Boolean,
value: {
diff --git a/packages/varlet-ui/types/progress.d.ts b/packages/varlet-ui/types/progress.d.ts
index a73a4cde953..60e5c31baf3 100644
--- a/packages/varlet-ui/types/progress.d.ts
+++ b/packages/varlet-ui/types/progress.d.ts
@@ -12,7 +12,7 @@ export interface ProgressProps extends BasicAttributes {
type?: ProgressType
indeterminate?: boolean
lineWidth?: string | number
- color?: string
+ color?: string | Record
trackColor?: string
label?: boolean
labelClass?: string
diff --git a/packages/varlet-use/src/index.ts b/packages/varlet-use/src/index.ts
index 7fd13db237c..26eb877568a 100644
--- a/packages/varlet-use/src/index.ts
+++ b/packages/varlet-use/src/index.ts
@@ -7,3 +7,4 @@ export * from './useChildren.js'
export * from './onWindowResize.js'
export * from './useInitialized.js'
export * from './useTouch.js'
+export * from './useId.js'
diff --git a/packages/varlet-use/src/useId.ts b/packages/varlet-use/src/useId.ts
new file mode 100644
index 00000000000..129a0f17eb2
--- /dev/null
+++ b/packages/varlet-use/src/useId.ts
@@ -0,0 +1,14 @@
+import { ref, getCurrentInstance } from 'vue'
+import { kebabCase } from '@varlet/shared'
+
+export function useId() {
+ const id = ref()
+ const instance = getCurrentInstance()!
+
+ // @ts-ignore
+ const isTestEnv = process.env.NODE_ENV === 'test'
+ const name = kebabCase(instance.type.name!)
+ id.value = isTestEnv ? name : `${name}-${instance.uid}`
+
+ return id
+}