@fjyueke/bify-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +248 -0
- package/metaData/components/action-sheet/api.md +74 -0
- package/metaData/components/action-sheet/doc.md +243 -0
- package/metaData/components/action-sheet/example/index.tsx +116 -0
- package/metaData/components/area-picker/api.md +25 -0
- package/metaData/components/area-picker/doc.md +132 -0
- package/metaData/components/area-picker/example/index.tsx +60 -0
- package/metaData/components/avatar/api.md +19 -0
- package/metaData/components/avatar/doc.md +170 -0
- package/metaData/components/avatar/example/index.tsx +76 -0
- package/metaData/components/back-top/api.md +21 -0
- package/metaData/components/back-top/doc.md +142 -0
- package/metaData/components/back-top/example/index.tsx +96 -0
- package/metaData/components/backdrop/api.md +20 -0
- package/metaData/components/backdrop/doc.md +98 -0
- package/metaData/components/backdrop/example/index.tsx +33 -0
- package/metaData/components/badge/api.md +10 -0
- package/metaData/components/badge/doc.md +169 -0
- package/metaData/components/badge/example/index.tsx +81 -0
- package/metaData/components/button/api.md +31 -0
- package/metaData/components/button/doc.md +235 -0
- package/metaData/components/button/example/index.tsx +235 -0
- package/metaData/components/calendar/api.md +62 -0
- package/metaData/components/calendar/doc.md +516 -0
- package/metaData/components/calendar/example/index.tsx +501 -0
- package/metaData/components/cascader/api.md +55 -0
- package/metaData/components/cascader/doc.md +358 -0
- package/metaData/components/cascader/example/index.tsx +159 -0
- package/metaData/components/cell/api.md +37 -0
- package/metaData/components/cell/doc.md +158 -0
- package/metaData/components/cell/example/index.tsx +44 -0
- package/metaData/components/checkbox/api.md +35 -0
- package/metaData/components/checkbox/doc.md +203 -0
- package/metaData/components/checkbox/example/index.tsx +94 -0
- package/metaData/components/circle/api.md +17 -0
- package/metaData/components/circle/doc.md +123 -0
- package/metaData/components/circle/example/index.tsx +81 -0
- package/metaData/components/collapse/api.md +31 -0
- package/metaData/components/collapse/doc.md +142 -0
- package/metaData/components/collapse/example/index.tsx +81 -0
- package/metaData/components/config-provider/api.md +7 -0
- package/metaData/components/config-provider/doc.md +193 -0
- package/metaData/components/config-provider/example/index.tsx +54 -0
- package/metaData/components/countdown/api.md +46 -0
- package/metaData/components/countdown/doc.md +167 -0
- package/metaData/components/countdown/example/index.tsx +70 -0
- package/metaData/components/datetime-picker/api.md +25 -0
- package/metaData/components/datetime-picker/doc.md +317 -0
- package/metaData/components/datetime-picker/example/index.tsx +265 -0
- package/metaData/components/dialog/api.md +66 -0
- package/metaData/components/dialog/doc.md +292 -0
- package/metaData/components/dialog/example/index.tsx +138 -0
- package/metaData/components/divider/api.md +15 -0
- package/metaData/components/divider/doc.md +108 -0
- package/metaData/components/divider/example/index.tsx +45 -0
- package/metaData/components/dropdown-menu/api.md +37 -0
- package/metaData/components/dropdown-menu/doc.md +279 -0
- package/metaData/components/dropdown-menu/example/index.tsx +182 -0
- package/metaData/components/empty/api.md +20 -0
- package/metaData/components/empty/doc.md +126 -0
- package/metaData/components/empty/example/index.tsx +66 -0
- package/metaData/components/field/api.md +10 -0
- package/metaData/components/field/doc.md +274 -0
- package/metaData/components/field/example/index.tsx +203 -0
- package/metaData/components/fixed-nav/api.md +21 -0
- package/metaData/components/fixed-nav/doc.md +196 -0
- package/metaData/components/fixed-nav/example/index.tsx +80 -0
- package/metaData/components/fixed-view/api.md +10 -0
- package/metaData/components/fixed-view/doc.md +25 -0
- package/metaData/components/fixed-view/example/index.tsx +12 -0
- package/metaData/components/flex/api.md +18 -0
- package/metaData/components/flex/doc.md +103 -0
- package/metaData/components/flex/example/index.tsx +58 -0
- package/metaData/components/floating-bubble/api.md +18 -0
- package/metaData/components/floating-bubble/doc.md +94 -0
- package/metaData/components/floating-bubble/example/index.tsx +55 -0
- package/metaData/components/floating-panel/api.md +19 -0
- package/metaData/components/floating-panel/doc.md +174 -0
- package/metaData/components/floating-panel/example/index.tsx +131 -0
- package/metaData/components/form/api.md +124 -0
- package/metaData/components/form/doc.md +759 -0
- package/metaData/components/form/example/index.tsx +222 -0
- package/metaData/components/grid/api.md +28 -0
- package/metaData/components/grid/doc.md +167 -0
- package/metaData/components/grid/example/index.tsx +80 -0
- package/metaData/components/image/api.md +42 -0
- package/metaData/components/image/doc.md +117 -0
- package/metaData/components/image/example/index.tsx +76 -0
- package/metaData/components/index-list/api.md +39 -0
- package/metaData/components/index-list/doc.md +176 -0
- package/metaData/components/index-list/example/index.tsx +110 -0
- package/metaData/components/list/api.md +30 -0
- package/metaData/components/list/doc.md +317 -0
- package/metaData/components/list/example/index.tsx +218 -0
- package/metaData/components/loading/api.md +10 -0
- package/metaData/components/loading/doc.md +113 -0
- package/metaData/components/loading/example/index.tsx +47 -0
- package/metaData/components/navbar/api.md +26 -0
- package/metaData/components/navbar/doc.md +85 -0
- package/metaData/components/navbar/example/index.tsx +28 -0
- package/metaData/components/notice-bar/api.md +28 -0
- package/metaData/components/notice-bar/doc.md +154 -0
- package/metaData/components/notice-bar/example/index.tsx +107 -0
- package/metaData/components/notify/api.md +28 -0
- package/metaData/components/notify/doc.md +140 -0
- package/metaData/components/notify/example/index.tsx +89 -0
- package/metaData/components/number-keyboard/api.md +21 -0
- package/metaData/components/number-keyboard/doc.md +247 -0
- package/metaData/components/number-keyboard/example/index.tsx +201 -0
- package/metaData/components/pagination/api.md +18 -0
- package/metaData/components/pagination/doc.md +113 -0
- package/metaData/components/pagination/example/index.tsx +73 -0
- package/metaData/components/password-input/api.md +25 -0
- package/metaData/components/password-input/doc.md +126 -0
- package/metaData/components/password-input/example/index.tsx +124 -0
- package/metaData/components/picker/api.md +61 -0
- package/metaData/components/picker/doc.md +336 -0
- package/metaData/components/picker/example/index.tsx +232 -0
- package/metaData/components/popup/api.md +48 -0
- package/metaData/components/popup/doc.md +150 -0
- package/metaData/components/popup/example/index.tsx +214 -0
- package/metaData/components/progress/api.md +11 -0
- package/metaData/components/progress/doc.md +105 -0
- package/metaData/components/progress/example/index.tsx +58 -0
- package/metaData/components/pull-refresh/api.md +18 -0
- package/metaData/components/pull-refresh/doc.md +198 -0
- package/metaData/components/pull-refresh/example/index.tsx +153 -0
- package/metaData/components/radio/api.md +26 -0
- package/metaData/components/radio/doc.md +201 -0
- package/metaData/components/radio/example/index.tsx +103 -0
- package/metaData/components/rate/api.md +23 -0
- package/metaData/components/rate/doc.md +122 -0
- package/metaData/components/rate/example/index.tsx +36 -0
- package/metaData/components/rolling-text/api.md +23 -0
- package/metaData/components/rolling-text/doc.md +153 -0
- package/metaData/components/rolling-text/example/index.tsx +150 -0
- package/metaData/components/safe-area/api.md +8 -0
- package/metaData/components/safe-area/doc.md +30 -0
- package/metaData/components/safe-area/example/index.tsx +16 -0
- package/metaData/components/search/api.md +35 -0
- package/metaData/components/search/doc.md +185 -0
- package/metaData/components/search/example/index.tsx +101 -0
- package/metaData/components/share-sheet/api.md +48 -0
- package/metaData/components/share-sheet/doc.md +215 -0
- package/metaData/components/share-sheet/example/index.tsx +143 -0
- package/metaData/components/sidebar/api.md +28 -0
- package/metaData/components/sidebar/doc.md +122 -0
- package/metaData/components/sidebar/example/index.tsx +58 -0
- package/metaData/components/signature/api.md +19 -0
- package/metaData/components/signature/doc.md +115 -0
- package/metaData/components/signature/example/index.tsx +56 -0
- package/metaData/components/skeleton/api.md +45 -0
- package/metaData/components/skeleton/doc.md +131 -0
- package/metaData/components/skeleton/example/index.tsx +80 -0
- package/metaData/components/slider/api.md +28 -0
- package/metaData/components/slider/doc.md +151 -0
- package/metaData/components/slider/example/index.tsx +54 -0
- package/metaData/components/space/api.md +12 -0
- package/metaData/components/space/doc.md +125 -0
- package/metaData/components/space/example/index.tsx +75 -0
- package/metaData/components/stepper/api.md +37 -0
- package/metaData/components/stepper/doc.md +152 -0
- package/metaData/components/stepper/example/index.tsx +45 -0
- package/metaData/components/steps/api.md +9 -0
- package/metaData/components/steps/doc.md +143 -0
- package/metaData/components/steps/example/index.tsx +93 -0
- package/metaData/components/sticky/api.md +16 -0
- package/metaData/components/sticky/doc.md +87 -0
- package/metaData/components/sticky/example/index.tsx +62 -0
- package/metaData/components/swipe-cell/api.md +19 -0
- package/metaData/components/swipe-cell/doc.md +105 -0
- package/metaData/components/swipe-cell/example/index.tsx +62 -0
- package/metaData/components/swiper/api.md +22 -0
- package/metaData/components/swiper/doc.md +228 -0
- package/metaData/components/swiper/example/index.tsx +118 -0
- package/metaData/components/switch/api.md +17 -0
- package/metaData/components/switch/doc.md +110 -0
- package/metaData/components/switch/example/index.tsx +57 -0
- package/metaData/components/tabbar/api.md +27 -0
- package/metaData/components/tabbar/doc.md +160 -0
- package/metaData/components/tabbar/example/index.tsx +99 -0
- package/metaData/components/tabs/api.md +36 -0
- package/metaData/components/tabs/doc.md +307 -0
- package/metaData/components/tabs/example/index.tsx +231 -0
- package/metaData/components/tag/api.md +17 -0
- package/metaData/components/tag/doc.md +162 -0
- package/metaData/components/tag/example/index.tsx +84 -0
- package/metaData/components/text-ellipsis/api.md +26 -0
- package/metaData/components/text-ellipsis/doc.md +135 -0
- package/metaData/components/text-ellipsis/example/index.tsx +44 -0
- package/metaData/components/timeline/api.md +20 -0
- package/metaData/components/timeline/doc.md +210 -0
- package/metaData/components/timeline/example/index.tsx +145 -0
- package/metaData/components/toast/api.md +39 -0
- package/metaData/components/toast/doc.md +256 -0
- package/metaData/components/toast/example/index.tsx +136 -0
- package/metaData/components/tree-select/api.md +19 -0
- package/metaData/components/tree-select/doc.md +185 -0
- package/metaData/components/tree-select/example/index.tsx +112 -0
- package/metaData/components/uploader/api.md +32 -0
- package/metaData/components/uploader/doc.md +340 -0
- package/metaData/components/uploader/example/index.tsx +222 -0
- package/metaData/components/watermark/api.md +18 -0
- package/metaData/components/watermark/doc.md +97 -0
- package/metaData/components/watermark/example/index.tsx +62 -0
- package/metaData/components-index.json +274 -0
- package/package.json +56 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Signature 签名
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于签名场景的组件,基于 Canvas 实现。
|
|
6
|
+
|
|
7
|
+
请升级 `taroify` 到 >= `v0.1.1-alpha.2` 版本来使用该组件。
|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Signature } from "@fjyueke/bify-core"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 代码演示
|
|
16
|
+
|
|
17
|
+
### 基础用法
|
|
18
|
+
|
|
19
|
+
Canvas 实例提供两个方法
|
|
20
|
+
|
|
21
|
+
- `getImage`
|
|
22
|
+
- `image`:签名对应的图片,为 base64 字符串格式。若签名为空,则返回空字符串。
|
|
23
|
+
- `canvas`:Canvas 元素。
|
|
24
|
+
- `clear`:清空
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Signature, SignatureInstance, Flex, Button } from "@fjyueke/bify-core"
|
|
28
|
+
|
|
29
|
+
function BasicSignature() {
|
|
30
|
+
const ref = useRef<SignatureInstance>(null)
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Signature ref={ref} />
|
|
34
|
+
<Flex justify="end">
|
|
35
|
+
<Button
|
|
36
|
+
size="small"
|
|
37
|
+
onClick={() => {
|
|
38
|
+
ref.current?.clear()
|
|
39
|
+
}}
|
|
40
|
+
style={{ marginRight: "1rem" }}
|
|
41
|
+
>
|
|
42
|
+
取消
|
|
43
|
+
</Button>
|
|
44
|
+
<Button
|
|
45
|
+
size="small"
|
|
46
|
+
color="primary"
|
|
47
|
+
onClick={() => {
|
|
48
|
+
console.log(ref.current?.getImage())
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
确认
|
|
52
|
+
</Button>
|
|
53
|
+
</Flex>
|
|
54
|
+
</>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 自定义颜色
|
|
60
|
+
|
|
61
|
+
通过 `penColor` 来自定义笔触颜色。
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Signature penColor="#ff0000" />
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 自定义线宽
|
|
68
|
+
|
|
69
|
+
通过 `lineWidth` 来自定义线条宽度。
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Signature lineWidth={6} />
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 自定义背景颜色
|
|
76
|
+
|
|
77
|
+
通过 `backgroundColor` 来自定义背景颜色。
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<Signature backgroundColor="#eee" />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## API
|
|
84
|
+
|
|
85
|
+
### Signature Props
|
|
86
|
+
|
|
87
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
88
|
+
| --------------- | ------------------ | -------- | ---------------- |
|
|
89
|
+
| type | 导出图片类型 | _string_ | `png` |
|
|
90
|
+
| penColor | 笔触颜色,默认黑色 | _string_ | `#000` |
|
|
91
|
+
| lineWidth | 线条宽度 | _number_ | `3` |
|
|
92
|
+
| backgroundColor | 背景颜色 | _string_ | - |
|
|
93
|
+
| canvasId | canvas id | _string_ | `taroify-canvas` |
|
|
94
|
+
|
|
95
|
+
### Signature Events
|
|
96
|
+
|
|
97
|
+
| 事件名 | 说明 | 回调参数 |
|
|
98
|
+
| --------- | -------------- | -------- |
|
|
99
|
+
| onStart | 开始签名时触发 | - |
|
|
100
|
+
| onEnd | 结束签名时触发 | - |
|
|
101
|
+
| onSigning | 签名过程中触发 | - |
|
|
102
|
+
|
|
103
|
+
## 主题定制
|
|
104
|
+
|
|
105
|
+
### 样式变量
|
|
106
|
+
|
|
107
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
108
|
+
|
|
109
|
+
| 名称 | 默认值 | 描述 |
|
|
110
|
+
| ------------------------------ | --------------------------- | ------------ |
|
|
111
|
+
| --signature-padding | _var(--van-padding-xs)_ | - |
|
|
112
|
+
| --signature-content-height | _200px_ | 画布高度 |
|
|
113
|
+
| --signature-content-background | _var(--background-color-2)_ | 画布背景色 |
|
|
114
|
+
| --signature-content-border | _1px dotted #dadada_ | 画布边框样式 |
|
|
115
|
+
| --signature-border-radius | _8px_ | 画布圆角 |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useRef } from "react"
|
|
2
|
+
import { Signature, SignatureInstance, Flex, Button } from "@fjyueke/bify-core"
|
|
3
|
+
import Block from "../../../components/block"
|
|
4
|
+
import Page from "../../../components/page"
|
|
5
|
+
import "./index.scss"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function BasicSignature() {
|
|
9
|
+
const ref = useRef<SignatureInstance>(null)
|
|
10
|
+
return <>
|
|
11
|
+
<Signature ref={ref} />
|
|
12
|
+
<Flex justify="end">
|
|
13
|
+
<Button size="small" onClick={() => { ref.current?.clear() }} style={{ marginRight: "1rem" }}>取消</Button>
|
|
14
|
+
<Button size="small" color="primary" onClick={() => { console.log(ref.current?.getImage()) }}>确认</Button>
|
|
15
|
+
</Flex>
|
|
16
|
+
</>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PenColorSignature() {
|
|
20
|
+
return <Signature penColor="#ff0000" />
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function LineWidthSignature() {
|
|
24
|
+
return <Signature lineWidth={6} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function BackgroundColorSignature() {
|
|
28
|
+
const ref = useRef<SignatureInstance>(null)
|
|
29
|
+
return <>
|
|
30
|
+
<Signature ref={ref} backgroundColor="#eee" />
|
|
31
|
+
<Flex justify="end">
|
|
32
|
+
<Button size="small" onClick={() => { ref.current?.clear() }} style={{ marginRight: "1rem" }}>取消</Button>
|
|
33
|
+
<Button size="small" color="primary" onClick={() => { console.log(ref.current?.getImage()) }}>确认</Button>
|
|
34
|
+
</Flex>
|
|
35
|
+
</>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export default function SignatureDemo() {
|
|
40
|
+
return (
|
|
41
|
+
<Page title="Signature 签名" className="signature-demo">
|
|
42
|
+
<Block title="基础用法">
|
|
43
|
+
<BasicSignature />
|
|
44
|
+
</Block>
|
|
45
|
+
<Block title="自定义颜色">
|
|
46
|
+
<PenColorSignature />
|
|
47
|
+
</Block>
|
|
48
|
+
<Block title="自定义线宽">
|
|
49
|
+
<LineWidthSignature />
|
|
50
|
+
</Block>
|
|
51
|
+
<Block title="自定义背景颜色">
|
|
52
|
+
<BackgroundColorSignature />
|
|
53
|
+
</Block>
|
|
54
|
+
</Page>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| row | 段落占位图行数 | _number \| string_ | `0` |
|
|
8
|
+
| rowWidth | 段落占位图宽度,可传数组来设置每一行的宽度 | _number \| string \| (number \| string)[]_ | `100%` |
|
|
9
|
+
| title | 是否显示标题占位图 | _boolean_ | `false` |
|
|
10
|
+
| avatar | 是否显示头像占位图 | _boolean_ | `false` |
|
|
11
|
+
| loading | 是否显示骨架屏,传 `false` 时会展示子组件内容 | _boolean_ | `true` |
|
|
12
|
+
| animate | 是否开启动画 | _boolean_ | `true` |
|
|
13
|
+
| round | 是否将标题和段落显示为圆角风格 | _boolean_ | `false` |
|
|
14
|
+
| titleWidth | 标题占位图宽度 | _number \| string_ | `40%` |
|
|
15
|
+
| avatarSize | 头像占位图大小 | _number \| string_ | `32px` |
|
|
16
|
+
| avatarShape | 头像占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
17
|
+
| template | 骨架屏自定义 | _ReactNode_ | `-` |
|
|
18
|
+
|
|
19
|
+
### Skeleton.Paragraph Props
|
|
20
|
+
|
|
21
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| round | 是否将段落显示为圆角风格 | _boolean_ | `false` |
|
|
24
|
+
| rowWidth | 段落占位图宽度 | _number \| string_ | `100%` |
|
|
25
|
+
|
|
26
|
+
### Skeleton.Title Props
|
|
27
|
+
|
|
28
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| round | 是否将段落显示为圆角风格 | _boolean_ | `false` |
|
|
31
|
+
| titleWidth | 标题占位图宽度 | _number \| string_ | `100%` |
|
|
32
|
+
|
|
33
|
+
### Skeleton.Avatar Props
|
|
34
|
+
|
|
35
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| avatarSize | 头像占位图大小 | _number \| string_ | `32px` |
|
|
38
|
+
| avatarShape | 头像占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
39
|
+
|
|
40
|
+
### Skeleton.Image Props
|
|
41
|
+
|
|
42
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| imageSize | 图片占位图大小 | _number \| string_ | `32px` |
|
|
45
|
+
| imageShape | 图片占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Skeleton 骨架屏
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于在内容加载过程中展示一组占位图形。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Skeleton } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
通过 `title` 属性显示标题占位图,通过 `row` 属性配置占位段落行数。
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Skeleton title row={3} />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 显示头像
|
|
24
|
+
|
|
25
|
+
通过 `avatar` 属性显示头像占位图。
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Skeleton title avatar row={3} />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 展示子组件
|
|
32
|
+
|
|
33
|
+
将 `loading` 属性设置成 `false` 表示内容加载完成,此时会隐藏占位图,并显示 `Skeleton` 的子组件。
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<Skeleton title avatar row={3} loading={loading}>
|
|
37
|
+
<View>实际内容</View>
|
|
38
|
+
</Skeleton>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 自定义展示内容
|
|
42
|
+
|
|
43
|
+
通过 `template` 属性完成自定义内容的展示。
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
const template = () => {
|
|
47
|
+
return (
|
|
48
|
+
<View
|
|
49
|
+
style={{ display: "flex", width: "100%" }}
|
|
50
|
+
>
|
|
51
|
+
<Skeleton.Image />
|
|
52
|
+
<View
|
|
53
|
+
style={{ flex: 1, marginLeft: 16 }}
|
|
54
|
+
>
|
|
55
|
+
<Skeleton.Paragraph rowWidth="60%" />
|
|
56
|
+
<Skeleton.Paragraph />
|
|
57
|
+
<Skeleton.Paragraph />
|
|
58
|
+
<Skeleton.Paragraph />
|
|
59
|
+
<Skeleton.Paragraph />
|
|
60
|
+
<Skeleton.Paragraph />
|
|
61
|
+
</View>
|
|
62
|
+
</View>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
<Skeleton template={template}/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
### Props
|
|
72
|
+
|
|
73
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| row | 段落占位图行数 | _number \| string_ | `0` |
|
|
76
|
+
| rowWidth | 段落占位图宽度,可传数组来设置每一行的宽度 | _number \| string \| (number \| string)[]_ | `100%` |
|
|
77
|
+
| title | 是否显示标题占位图 | _boolean_ | `false` |
|
|
78
|
+
| avatar | 是否显示头像占位图 | _boolean_ | `false` |
|
|
79
|
+
| loading | 是否显示骨架屏,传 `false` 时会展示子组件内容 | _boolean_ | `true` |
|
|
80
|
+
| animate | 是否开启动画 | _boolean_ | `true` |
|
|
81
|
+
| round | 是否将标题和段落显示为圆角风格 | _boolean_ | `false` |
|
|
82
|
+
| titleWidth | 标题占位图宽度 | _number \| string_ | `40%` |
|
|
83
|
+
| avatarSize | 头像占位图大小 | _number \| string_ | `32px` |
|
|
84
|
+
| avatarShape | 头像占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
85
|
+
| template | 骨架屏自定义 | _ReactNode_ | `-` |
|
|
86
|
+
|
|
87
|
+
### Skeleton.Paragraph Props
|
|
88
|
+
|
|
89
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| round | 是否将段落显示为圆角风格 | _boolean_ | `false` |
|
|
92
|
+
| rowWidth | 段落占位图宽度 | _number \| string_ | `100%` |
|
|
93
|
+
|
|
94
|
+
### Skeleton.Title Props
|
|
95
|
+
|
|
96
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
97
|
+
| --- | --- | --- | --- |
|
|
98
|
+
| round | 是否将段落显示为圆角风格 | _boolean_ | `false` |
|
|
99
|
+
| titleWidth | 标题占位图宽度 | _number \| string_ | `100%` |
|
|
100
|
+
|
|
101
|
+
### Skeleton.Avatar Props
|
|
102
|
+
|
|
103
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
104
|
+
| --- | --- | --- | --- |
|
|
105
|
+
| avatarSize | 头像占位图大小 | _number \| string_ | `32px` |
|
|
106
|
+
| avatarShape | 头像占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
107
|
+
|
|
108
|
+
### Skeleton.Image Props
|
|
109
|
+
|
|
110
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
| imageSize | 图片占位图大小 | _number \| string_ | `32px` |
|
|
113
|
+
| imageShape | 图片占位图形状,可选值为 `square` | _square \| round_ | `round` |
|
|
114
|
+
|
|
115
|
+
## 主题定制
|
|
116
|
+
|
|
117
|
+
### 样式变量
|
|
118
|
+
|
|
119
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
120
|
+
|
|
121
|
+
| 名称 | 默认值 | 描述 |
|
|
122
|
+
|---------------------------------------------|-------------------------------|-----|
|
|
123
|
+
| --skeleton-avatar-size | _32px * $hd_ | - |
|
|
124
|
+
| --skeleton-avatar-background | _var(--active-color)_ | - |
|
|
125
|
+
| --skeleton-duration | _1.2s_ | - |
|
|
126
|
+
| --skeleton-paragraph-height | _16px * $hd_ | - |
|
|
127
|
+
| --skeleton-paragraph-background | _var(--active-color)_ | - |
|
|
128
|
+
| --skeleton-title-width | _40%_ | - |
|
|
129
|
+
| --skeleton-paragraph-margin-top | _var(--padding-xs)_ | - |
|
|
130
|
+
| --skeleton-image-size | _96px * $hd_ | - |
|
|
131
|
+
| --skeleton-image-radius | _24px * $hd_ | - |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
import { View, Image } from "@tarojs/components"
|
|
3
|
+
import { Skeleton, Switch, Flex } from "@fjyueke/bify-core"
|
|
4
|
+
import Block from "../../../components/block"
|
|
5
|
+
import Page from "../../../components/page"
|
|
6
|
+
|
|
7
|
+
import "./index.scss"
|
|
8
|
+
|
|
9
|
+
function BasicSkeleton() {
|
|
10
|
+
return (
|
|
11
|
+
<Block title="基础用法">
|
|
12
|
+
<Skeleton title row={3} />
|
|
13
|
+
</Block>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function AvatarSkeleton() {
|
|
18
|
+
return (
|
|
19
|
+
<Block title="显示头像">
|
|
20
|
+
<Skeleton title avatar row={3} />
|
|
21
|
+
</Block>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function LoadingSkeleton() {
|
|
26
|
+
const [loading, setLoading] = useState(true)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Block title="显示子组件">
|
|
30
|
+
<Switch checked={loading} onChange={setLoading} size={24} className="demo-switch" />
|
|
31
|
+
<Skeleton title avatar row={3} loading={loading}>
|
|
32
|
+
<Flex className="demo-preview">
|
|
33
|
+
<Image src="https://img.yzcdn.cn/vant/logo.png" className="demo-image" />
|
|
34
|
+
<View>
|
|
35
|
+
<View className="demo-title">关于 Taroify</View>
|
|
36
|
+
<View className="demo-content">
|
|
37
|
+
<View>Taroify 是移动端组件库 Vant 的 Taro React 版本。</View>
|
|
38
|
+
<View>两者基于相同的视觉规范,提供近似一致的 API 接口,助力开发者快速搭建小程序应用。</View>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
</Flex>
|
|
42
|
+
</Skeleton>
|
|
43
|
+
</Block>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function CustomSkeleton() {
|
|
48
|
+
return (
|
|
49
|
+
<Block title="自定义展示内容">
|
|
50
|
+
<Skeleton
|
|
51
|
+
template={
|
|
52
|
+
<View style={{ display: "flex", width: "100%" }}>
|
|
53
|
+
<Skeleton.Image />
|
|
54
|
+
<View
|
|
55
|
+
style={{ flex: 1, marginLeft: 16 }}
|
|
56
|
+
>
|
|
57
|
+
<Skeleton.Paragraph rowWidth="60%" />
|
|
58
|
+
<Skeleton.Paragraph />
|
|
59
|
+
<Skeleton.Paragraph />
|
|
60
|
+
<Skeleton.Paragraph />
|
|
61
|
+
<Skeleton.Paragraph />
|
|
62
|
+
<Skeleton.Paragraph />
|
|
63
|
+
</View>
|
|
64
|
+
</View>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
</Block>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default function SkeletonDemo() {
|
|
72
|
+
return (
|
|
73
|
+
<Page title="Skeleton 骨架屏" className="skeleton-demo">
|
|
74
|
+
<BasicSkeleton />
|
|
75
|
+
<AvatarSkeleton />
|
|
76
|
+
<LoadingSkeleton />
|
|
77
|
+
<CustomSkeleton />
|
|
78
|
+
</Page>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Slider Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| defaultValue | 当前进度百分比,在双滑块模式下为数组格式 | _number \| [number, number]_ | `0` |
|
|
8
|
+
| value | 当前进度百分比,在双滑块模式下为数组格式 | _number \| [number, number]_ | `0` |
|
|
9
|
+
| max | 最大值 | _number \| string_ | `100` |
|
|
10
|
+
| min | 最小值 | _number \| string_ | `0` |
|
|
11
|
+
| step | 步长 | _number \| string_ | `1` |
|
|
12
|
+
| size | 进度条高度,默认单位为 `px` | _number \| string_ | `2px` |
|
|
13
|
+
| range | 是否开启双滑块模式 | _boolean_ | `false` |
|
|
14
|
+
| disabled | 是否禁用滑块 | _boolean_ | `false` |
|
|
15
|
+
| readonly | 是否为只读状态,只读状态下无法修改滑块的值 | _boolean_ | `false` |
|
|
16
|
+
| orientation | 滑块按钮展示方向,`vertical` 为垂直展示 | _SliderOrientation_ | `horizontal` |
|
|
17
|
+
|
|
18
|
+
### Slider.Thumb Props
|
|
19
|
+
|
|
20
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
21
|
+
| --- | --- | --- | --- |
|
|
22
|
+
| size | 滑块按钮大小,默认单位为 `px` |_number \| string_ | `24px` |
|
|
23
|
+
|
|
24
|
+
### Slider Events
|
|
25
|
+
|
|
26
|
+
| 事件名 | 说明 | 回调参数 |
|
|
27
|
+
|----------|--------------|-----------------|
|
|
28
|
+
| onChange | 进度变化且结束拖动后触发 | _value: number_ |
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Slider 滑块
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
滑动输入条,用于在给定的范围内选择一个值。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Slider } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<Slider defaultValue={50} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 双滑块
|
|
22
|
+
|
|
23
|
+
添加 `range` 属性就可以开启双滑块模式,确保 `value` 的值是一个数组。
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Slider range defaultValue={[20, 60]} />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 指定选择范围
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<Slider min={-50} max={50} defaultValue={0} />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 禁用
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Slider disabled defaultValue={50} />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 指定步长
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Slider step={10} defaultValue={50} />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 自定义样式
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Slider className="custom-color" size={4} defaultValue={50} />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```scss
|
|
54
|
+
.custom-color {
|
|
55
|
+
--slider-active-background-color: #ee0a24;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 自定义按钮
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
function StyledThumbSlider() {
|
|
63
|
+
const [value, setValue] = useState(50)
|
|
64
|
+
return (
|
|
65
|
+
<Slider className="custom-color" value={value} onChange={setValue}>
|
|
66
|
+
<Slider.Thumb>
|
|
67
|
+
<View className="custom-thumb">{value}</View>
|
|
68
|
+
</Slider.Thumb>
|
|
69
|
+
</Slider>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```scss
|
|
75
|
+
.custom-color {
|
|
76
|
+
--slider-active-background-color: #ee0a24;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.custom-thumb {
|
|
80
|
+
width: 26px * 2;
|
|
81
|
+
color: #fff;
|
|
82
|
+
font-size: 10px * 2;
|
|
83
|
+
line-height: 18px * 2;
|
|
84
|
+
text-align: center;
|
|
85
|
+
background-color: var(--slider-active-background-color);
|
|
86
|
+
border-radius: 100px * 2;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 垂直方向
|
|
91
|
+
|
|
92
|
+
设置 `orientation="vertical"` 属性后,滑块会垂直展示,且高度为 100% 父元素高度。
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<Slider orientation="vertical" defaultValue={50} />
|
|
96
|
+
<Slider
|
|
97
|
+
style={{ marginLeft: "100px" }}
|
|
98
|
+
range
|
|
99
|
+
orientation="vertical"
|
|
100
|
+
defaultValue={[20, 60]}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## API
|
|
105
|
+
|
|
106
|
+
### Slider Props
|
|
107
|
+
|
|
108
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
109
|
+
| --- | --- | --- | --- |
|
|
110
|
+
| defaultValue | 当前进度百分比,在双滑块模式下为数组格式 | _number \| [number, number]_ | `0` |
|
|
111
|
+
| value | 当前进度百分比,在双滑块模式下为数组格式 | _number \| [number, number]_ | `0` |
|
|
112
|
+
| max | 最大值 | _number \| string_ | `100` |
|
|
113
|
+
| min | 最小值 | _number \| string_ | `0` |
|
|
114
|
+
| step | 步长 | _number \| string_ | `1` |
|
|
115
|
+
| size | 进度条高度,默认单位为 `px` | _number \| string_ | `2px` |
|
|
116
|
+
| range | 是否开启双滑块模式 | _boolean_ | `false` |
|
|
117
|
+
| disabled | 是否禁用滑块 | _boolean_ | `false` |
|
|
118
|
+
| readonly | 是否为只读状态,只读状态下无法修改滑块的值 | _boolean_ | `false` |
|
|
119
|
+
| orientation | 滑块按钮展示方向,`vertical` 为垂直展示 | _SliderOrientation_ | `horizontal` |
|
|
120
|
+
|
|
121
|
+
### Slider.Thumb Props
|
|
122
|
+
|
|
123
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
124
|
+
| --- | --- | --- | --- |
|
|
125
|
+
| size | 滑块按钮大小,默认单位为 `px` |_number \| string_ | `24px` |
|
|
126
|
+
|
|
127
|
+
### Slider Events
|
|
128
|
+
|
|
129
|
+
| 事件名 | 说明 | 回调参数 |
|
|
130
|
+
|----------|--------------|-----------------|
|
|
131
|
+
| onChange | 进度变化且结束拖动后触发 | _value: number_ |
|
|
132
|
+
|
|
133
|
+
## 主题定制
|
|
134
|
+
|
|
135
|
+
### 样式变量
|
|
136
|
+
|
|
137
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
138
|
+
|
|
139
|
+
| 名称 | 默认值 | 描述 |
|
|
140
|
+
|------------------------------------|--------------------------------------------|-----|
|
|
141
|
+
| --slider-border-radius | _var(--border-radius-max)_ | - |
|
|
142
|
+
| --slider-active-background-color | _var(--blue)_ | - |
|
|
143
|
+
| --slider-inactive-background-color | _var(--gray-3)_ | - |
|
|
144
|
+
| --slider-disabled-opacity | _var(--disabled-opacity)_ | - |
|
|
145
|
+
| --slider-track-height | _2px * $hd_ | - |
|
|
146
|
+
| --slider-track-transition-duration | _var(--animation-duration-fast)_ | - |
|
|
147
|
+
| --slider-thumb-width | _24px * $hd_ | - |
|
|
148
|
+
| --slider-thumb-height | _24px * $hd_ | - |
|
|
149
|
+
| --slider-thumb-border-radius | _50%_ | - |
|
|
150
|
+
| --slider-thumb-background-color | _var(--white)_ | - |
|
|
151
|
+
| --slider-thumb-box-shadow | _0 1px * $hd 2px * $hd rgba(0, 0, 0, 0.5)_ | - |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Slider } from "@fjyueke/bify-core"
|
|
2
|
+
import { View } from "@tarojs/components"
|
|
3
|
+
import { useState } from "react"
|
|
4
|
+
import Block from "../../../components/block"
|
|
5
|
+
import Page from "../../../components/page"
|
|
6
|
+
import "./index.scss"
|
|
7
|
+
|
|
8
|
+
function StyledThumbSlider() {
|
|
9
|
+
const [value, setValue] = useState(50)
|
|
10
|
+
return (
|
|
11
|
+
<Slider className="custom-color" value={value} onChange={setValue}>
|
|
12
|
+
<Slider.Thumb>
|
|
13
|
+
<View className="custom-thumb">{value}</View>
|
|
14
|
+
</Slider.Thumb>
|
|
15
|
+
</Slider>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function SliderDemo() {
|
|
20
|
+
return (
|
|
21
|
+
<Page title="Slider 滑块" className="slider-demo">
|
|
22
|
+
<Block title="基础用法">
|
|
23
|
+
<Slider defaultValue={50} />
|
|
24
|
+
</Block>
|
|
25
|
+
<Block title="双滑块">
|
|
26
|
+
<Slider range defaultValue={[20, 60]} />
|
|
27
|
+
</Block>
|
|
28
|
+
<Block title="指定选择范围">
|
|
29
|
+
<Slider min={-50} max={50} defaultValue={0} />
|
|
30
|
+
</Block>
|
|
31
|
+
<Block title="禁用">
|
|
32
|
+
<Slider disabled defaultValue={50} />
|
|
33
|
+
</Block>
|
|
34
|
+
<Block title="指定步长">
|
|
35
|
+
<Slider step={10} defaultValue={50} />
|
|
36
|
+
</Block>
|
|
37
|
+
<Block title="自定义样式">
|
|
38
|
+
<Slider className="custom-color" size={4} defaultValue={50} />
|
|
39
|
+
</Block>
|
|
40
|
+
<Block title="自定义按钮">
|
|
41
|
+
<StyledThumbSlider />
|
|
42
|
+
</Block>
|
|
43
|
+
<Block title="自定义样式" className="vertical-slider">
|
|
44
|
+
<Slider orientation="vertical" defaultValue={50} />
|
|
45
|
+
<Slider
|
|
46
|
+
style={{ marginLeft: "100px" }}
|
|
47
|
+
range
|
|
48
|
+
orientation="vertical"
|
|
49
|
+
defaultValue={[20, 60]}
|
|
50
|
+
/>
|
|
51
|
+
</Block>
|
|
52
|
+
</Page>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --------------------- | ---------------------------------------------------------------------------- | --------------------------------------- | ------------ |
|
|
7
|
+
| direction | 垂直排列方式 可选值 `horizontal` `vertical` | _string_ | `horizontal` |
|
|
8
|
+
| size | 间距,可选值为 `mini` `small` `medium` `large`,或者自定义间距 | _string \| number \| [number, number?]_ | `small` |
|
|
9
|
+
| wrap | 子元素的换行方式,可选值为 `nowrap` `wrap` `wrap-reverse` | _boolean_ | `wrap` |
|
|
10
|
+
| justify | 主轴对齐方式,可选值为 `start` `end` `center` `space-around` `space-between` | _string_ | `start` |
|
|
11
|
+
| align | 交叉轴对齐方式,可选值为 `start` `center` `end` `baseline` `stretch` | _string_ | `start` |
|
|
12
|
+
| fill `v0.1.1-alpha.2` | 是否填充整个父元素 | _boolean_ | `false` |
|