diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 5b7bd48f..94965936 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -272,6 +272,9 @@ export default defineConfig({ }, { link: "/component/progress", text: "Progress 进度条" + }, { + link: "/component/circle", + text: "Circle 环形进度条" }, { link: "/component/sort-button", text: "SortButton 排序按钮" diff --git a/docs/component/circle.md b/docs/component/circle.md new file mode 100644 index 00000000..6e40e8b3 --- /dev/null +++ b/docs/component/circle.md @@ -0,0 +1,91 @@ + + +# Circle 环形进度条 0.1.19 + +圆环形的进度条组件,支持进度渐变动画。 + +## 基础用法 + +通过`v-model`表示进度条的当前进度,`text`属性控制进度条中间文字内容。 + +```html + +``` + +```ts +const current = ref(10) +``` + +## 宽度控制 + +通过`strokeWidth`属性来控制进度条宽度,默认`10px`。 + +```html + +``` + +## 颜色定制 + +通过`color`属性控制进度条颜色,默认`#1C64FD`,通过`layerColor`属性控制进度条轨道颜色,默认`#EBEEF5`。 + +```html + +``` + +## 渐变色 + +`color`属性支持传入对象格式来定义渐变色。 + +```html + +``` + +```ts +const gradientColor = { + '0%': '#ffd01e', + '100%': '#ee0a24' +} +``` + +## 进度条展开方向 + +通过`clockwise`属性控制进度条展开方向,`clockwise`为`false`时,进度会从逆时针方向开始。 + +```html + +``` + +## 大小定制 + +通过`size`属性控制进度条圆环直径,默认`100px`。 + +```html + +``` + + + +## Attributes + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | +| ----------------- | ---------------------------- | --------------------------- | ------------------------------------------ | --------------- | -------- | +| `v-model` \|`modelValue` | 当前进度 | number | - | `0` | 0.1.19 | +| `customClass` | 自定义class | string | - | - | 0.1.19 | +| `customStyle` | 自定义style | string | - | - | 0.1.19 | +| `rate` | 目标进度 | number \| string | - | `100` | 0.1.19 | +| `size` | 圆环直径,默认单位为 px | number | - | `100` | 0.1.19 | +| `color` | 进度条颜色 | string \| Record | - | `#4d80f0` | 0.1.19 | +| `layerColor` | 轨道颜色 | string | - | `#EBEEF5` | 0.1.19 | +| `fill` | 填充颜色 | string | - | `#ffffff` | 0.1.19 | +| `speed` | 动画速度(单位为 rate/s) | number | - | `50` | 0.1.19 | +| `text` | 文字 | string | - | - | 0.1.19 | +| `strokeWidth` | 进度条宽度,单位px | number | - | `10` | 0.1.19 | +| `strokeLinecap` | 进度条端点的形状 | string | `butt` \| `round` \| `square` | `round` | 0.1.19 | +| `clockwise` | 是否顺时针增加 | boolean | - | `true` | 0.1.19 | + + +## Circle 外部样式类 + +| 类名 | 说明 | 最低版本 | +|-----|------|--------| +| custom-class | 根结点样式 | - | \ No newline at end of file diff --git a/docs/component/watermark.md b/docs/component/watermark.md index ba776c1a..113f488f 100644 --- a/docs/component/watermark.md +++ b/docs/component/watermark.md @@ -3,6 +3,7 @@ # Watermark 水印 0.1.16 +在页面或组件上添加指定的图片或文字,可用于版权保护、品牌宣传等场景。 ## 基础用法 diff --git a/src/pages.json b/src/pages.json index 30cd5ab8..a4538f9b 100644 --- a/src/pages.json +++ b/src/pages.json @@ -561,6 +561,16 @@ }, "navigationBarTitleText": "Watermark 水印" } + }, + { + "path": "pages/circle/Index", + "name": "circle", + "style": { + "mp-alipay": { + "allowsBounceVertical": "NO" + }, + "navigationBarTitleText": "Circle 环形进度条" + } } ], // "tabBar": { diff --git a/src/pages/circle/index.vue b/src/pages/circle/index.vue new file mode 100644 index 00000000..50822f19 --- /dev/null +++ b/src/pages/circle/index.vue @@ -0,0 +1,49 @@ + + + diff --git a/src/pages/index/Index.vue b/src/pages/index/Index.vue index 343d45a4..e3b8614d 100644 --- a/src/pages/index/Index.vue +++ b/src/pages/index/Index.vue @@ -207,6 +207,10 @@ const list = ref([ id: 'progress', name: 'Progress 进度条' }, + { + id: 'circle', + name: 'Circle 环形进度条' + }, { id: 'sortButton', name: 'SortButton 排序按钮' diff --git a/src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss b/src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss index a1377a77..28bc6441 100644 --- a/src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss +++ b/src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss @@ -704,23 +704,26 @@ $-curtain-content-close-color: var(--wot-curtain-content-close-color, $-color-wh $-curtain-content-close-fs: var(--wot-curtain-content-close-fs, $-fs-big) !default; // 关闭按钮大小 // Notify -$notify-text-color: var(--wot-notify-text-color, $-color-white) !default; -$notify-padding: var(--wot-notify-padding, 8px 16px) !default; -$notify-font-size: var(--wot-notify-font-size, $-fs-content) !default; -$notify-line-height: var(--wot-notify-line-height, 20px) !default; -$notify-primary-background: var(--wot-notify-primary-background, $-color-theme) !default; -$notify-success-background: var(--wot-notify-success-background, $-color-success) !default; -$notify-danger-background: var(--wot-notify-danger-background, $-color-danger) !default; -$notify-warning-background: var(--wot-notify-warning-background, $-color-warning) !default; +$-notify-text-color: var(--wot-notify-text-color, $-color-white) !default; +$-notify-padding: var(--wot-notify-padding, 8px 16px) !default; +$-notify-font-size: var(--wot-notify-font-size, $-fs-content) !default; +$-notify-line-height: var(--wot-notify-line-height, 20px) !default; +$-notify-primary-background: var(--wot-notify-primary-background, $-color-theme) !default; +$-notify-success-background: var(--wot-notify-success-background, $-color-success) !default; +$-notify-danger-background: var(--wot-notify-danger-background, $-color-danger) !default; +$-notify-warning-background: var(--wot-notify-warning-background, $-color-warning) !default; // Skeleton -$skeleton-background-color: var(--wot-skeleton-background-color, #eee) !default; -$skeleton-animation-gradient: var(--wot-skeleton-animation-gradient, rgba(0, 0, 0, 0.04)) !default; -$skeleton-animation-flashed: var(--wot-skeleton-animation-flashed, rgba(230, 230, 230, 0.3)) !default; -$skeleton-text-height-default: var(--wot-skeleton-text-height-default, 16px) !default; -$skeleton-rect-height-default: var(--wot-skeleton-rect-height-default, 16px) !default; -$skeleton-circle-height-default: var(--wot-skeleton-circle-height-default, 48px) !default; -$skeleton-row-margin-bottom: var(--wot-skeleton-row-margin-bottom, 16px) !default; -$skeleton-border-radius-text: var(--wot-skeleton-border-radius-text, 2px) !default; -$skeleton-border-radius-rect: var(--wot-skeleton-border-radius-rect, 4px) !default; -$skeleton-border-radius-circle: var(--wot-skeleton-border-radius-circle, 50%) !default; \ No newline at end of file +$-skeleton-background-color: var(--wot-skeleton-background-color, #eee) !default; +$-skeleton-animation-gradient: var(--wot-skeleton-animation-gradient, rgba(0, 0, 0, 0.04)) !default; +$-skeleton-animation-flashed: var(--wot-skeleton-animation-flashed, rgba(230, 230, 230, 0.3)) !default; +$-skeleton-text-height-default: var(--wot-skeleton-text-height-default, 16px) !default; +$-skeleton-rect-height-default: var(--wot-skeleton-rect-height-default, 16px) !default; +$-skeleton-circle-height-default: var(--wot-skeleton-circle-height-default, 48px) !default; +$-skeleton-row-margin-bottom: var(--wot-skeleton-row-margin-bottom, 16px) !default; +$-skeleton-border-radius-text: var(--wot-skeleton-border-radius-text, 2px) !default; +$-skeleton-border-radius-rect: var(--wot-skeleton-border-radius-rect, 4px) !default; +$-skeleton-border-radius-circle: var(--wot-skeleton-border-radius-circle, 50%) !default; + +// circle +$-circle-text-color: var(--wot-circle-text-color, $-color-content) !default; // circle文字颜色 diff --git a/src/uni_modules/wot-design-uni/components/common/util.ts b/src/uni_modules/wot-design-uni/components/common/util.ts index bd228c14..7eb7162a 100644 --- a/src/uni_modules/wot-design-uni/components/common/util.ts +++ b/src/uni_modules/wot-design-uni/components/common/util.ts @@ -26,11 +26,11 @@ export function addUnit(num: number) { /** * @description 判断target是否对象 - * @param obj + * @param value * @return {boolean} */ -export function isObj(obj: any): boolean { - return Object.prototype.toString.call(obj) === '[object Object]' || typeof obj === 'object' +export function isObj(value: any): value is object { + return Object.prototype.toString.call(value) === '[object Object]' || typeof value === 'object' } /** diff --git a/src/uni_modules/wot-design-uni/components/wd-circle/index.scss b/src/uni_modules/wot-design-uni/components/wd-circle/index.scss new file mode 100644 index 00000000..dc7d13e4 --- /dev/null +++ b/src/uni_modules/wot-design-uni/components/wd-circle/index.scss @@ -0,0 +1,18 @@ +@import "../common/abstracts/variable.scss"; +@import "../common/abstracts/_mixin.scss"; + +@include b(circle) { + position: relative; + display: inline-block; + text-align: center; + + @include e(text) { + position: absolute; + z-index: 1; + top: 50%; + left: 0; + width: 100%; + transform: translateY(-50%); + color: $-circle-text-color; + } +} \ No newline at end of file diff --git a/src/uni_modules/wot-design-uni/components/wd-circle/wd-circle.vue b/src/uni_modules/wot-design-uni/components/wd-circle/wd-circle.vue new file mode 100644 index 00000000..6332109c --- /dev/null +++ b/src/uni_modules/wot-design-uni/components/wd-circle/wd-circle.vue @@ -0,0 +1,341 @@ + + + + + diff --git a/src/uni_modules/wot-design-uni/components/wd-notify/index.scss b/src/uni_modules/wot-design-uni/components/wd-notify/index.scss index 7c98a443..5df8f4d7 100644 --- a/src/uni_modules/wot-design-uni/components/wd-notify/index.scss +++ b/src/uni_modules/wot-design-uni/components/wd-notify/index.scss @@ -6,10 +6,10 @@ align-items: center; justify-content: center; box-sizing: border-box; - padding: $notify-padding; - font-size: $notify-font-size; - line-height: $notify-line-height; - color: $notify-text-color; + padding: $-notify-padding; + font-size: $-notify-font-size; + line-height: $-notify-line-height; + color: $-notify-text-color; // allow newline character white-space: pre-wrap; @@ -17,18 +17,18 @@ word-wrap: break-word; @include m(primary) { - background: $notify-primary-background; + background: $-notify-primary-background; } @include m(success) { - background: $notify-success-background; + background: $-notify-success-background; } @include m(danger) { - background: $notify-danger-background; + background: $-notify-danger-background; } @include m(warning) { - background: $notify-warning-background; + background: $-notify-warning-background; } } \ No newline at end of file diff --git a/src/uni_modules/wot-design-uni/components/wd-skeleton/index.scss b/src/uni_modules/wot-design-uni/components/wd-skeleton/index.scss index e755b997..6c0f25cf 100644 --- a/src/uni_modules/wot-design-uni/components/wd-skeleton/index.scss +++ b/src/uni_modules/wot-design-uni/components/wd-skeleton/index.scss @@ -13,7 +13,7 @@ @include e(row) { justify-content: space-between; - margin-bottom: $skeleton-row-margin-bottom; + margin-bottom: $-skeleton-row-margin-bottom; display: flex; align-items: center; @@ -23,8 +23,8 @@ } } @include e(col) { - border-radius: $skeleton-border-radius-text; - background-color: $skeleton-background-color; + border-radius: $-skeleton-border-radius-text; + background-color: $-skeleton-background-color; display: flex; align-items: center; justify-content: center; @@ -37,21 +37,21 @@ @include m(type) { &-text { width: 100%; - height: $skeleton-text-height-default; - border-radius: $skeleton-border-radius-text; + height: $-skeleton-text-height-default; + border-radius: $-skeleton-border-radius-text; } &-rect { width: 100%; - height: $skeleton-rect-height-default; - border-radius: $skeleton-border-radius-rect; + height: $-skeleton-rect-height-default; + border-radius: $-skeleton-border-radius-rect; } &-circle { flex-shrink: 0; - width: $skeleton-circle-height-default; - height: $skeleton-circle-height-default; - border-radius: $skeleton-border-radius-circle; + width: $-skeleton-circle-height-default; + height: $-skeleton-circle-height-default; + border-radius: $-skeleton-border-radius-circle; } } @include m(animation) { @@ -63,7 +63,7 @@ content: ' '; position: absolute; animation: wd-skeleton-gradient 1.5s linear 2s infinite; - background: linear-gradient(90deg, rgba(255, 255, 255, 0), $skeleton-animation-gradient, rgba(255, 255, 255, 0)); + background: linear-gradient(90deg, rgba(255, 255, 255, 0), $-skeleton-animation-gradient, rgba(255, 255, 255, 0)); inset: 0; } } @@ -87,7 +87,7 @@ } 50% { opacity: 0.3; - background-color: $skeleton-animation-flashed; + background-color: $-skeleton-animation-flashed; } 100% { opacity: 1; diff --git a/src/uni_modules/wot-design-uni/global.d.ts b/src/uni_modules/wot-design-uni/global.d.ts index 2d817581..03f08534 100644 --- a/src/uni_modules/wot-design-uni/global.d.ts +++ b/src/uni_modules/wot-design-uni/global.d.ts @@ -67,6 +67,8 @@ declare module '@vue/runtime-core' { WdTransition: typeof import('./components/wd-transition/wd-transition.vue')['default'] WdUpload: typeof import('./components/wd-upload/wd-upload.vue')['default'] WdNotify: typeof import('./components/wd-notify/wd-notify.vue')['default'] + WdWatermark: typeof import('./components/wd-watermark/wd-watermark.vue')['default'] + WdCircle: typeof import('./components/wd-circle/wd-circle.vue')['default'] } }