@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,203 @@
|
|
|
1
|
+
import { Button, Cell, Field, Input, Textarea } from "@fjyueke/bify-core"
|
|
2
|
+
import { getEnv } from "@tarojs/taro"
|
|
3
|
+
import { MusicOutlined, SmileOutlined, WarningOutlined } from "@fjyueke/bify-icons"
|
|
4
|
+
import { useState } from "react"
|
|
5
|
+
import Block from "../../../components/block"
|
|
6
|
+
import CustomWrapper from "../../../components/custom-wrapper"
|
|
7
|
+
import Page from "../../../components/page"
|
|
8
|
+
import "./index.scss"
|
|
9
|
+
|
|
10
|
+
function BasicField() {
|
|
11
|
+
const [value, setValue] = useState("")
|
|
12
|
+
return (
|
|
13
|
+
<Cell.Group inset>
|
|
14
|
+
<Field label="文本">
|
|
15
|
+
<Input placeholder="请输入文本" value={value} onChange={(e) => setValue(e.detail.value)} />
|
|
16
|
+
</Field>
|
|
17
|
+
</Cell.Group>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function CustomField() {
|
|
22
|
+
const [text, setText] = useState("")
|
|
23
|
+
const [idcard, setIdcard] = useState("")
|
|
24
|
+
const [number, setNumber] = useState("")
|
|
25
|
+
const [digit, setDigit] = useState("")
|
|
26
|
+
const [password, setPassword] = useState("")
|
|
27
|
+
return (
|
|
28
|
+
<Cell.Group inset>
|
|
29
|
+
<Field label="文本">
|
|
30
|
+
<Input placeholder="请输入文本" value={text} onChange={(e) => setText(e.detail.value)} />
|
|
31
|
+
</Field>
|
|
32
|
+
<Field label="身份证号">
|
|
33
|
+
<Input
|
|
34
|
+
type="idcard"
|
|
35
|
+
placeholder="请输入身份证号"
|
|
36
|
+
value={idcard}
|
|
37
|
+
onChange={(e) => setIdcard(e.detail.value)}
|
|
38
|
+
/>
|
|
39
|
+
</Field>
|
|
40
|
+
<Field label="整数">
|
|
41
|
+
<Input
|
|
42
|
+
type="number"
|
|
43
|
+
placeholder="请输入整数"
|
|
44
|
+
value={number}
|
|
45
|
+
onChange={(e) => setNumber(e.detail.value)}
|
|
46
|
+
/>
|
|
47
|
+
</Field>
|
|
48
|
+
<Field label="数字">
|
|
49
|
+
<Input
|
|
50
|
+
type="digit"
|
|
51
|
+
placeholder="请输入数字(支持小数)"
|
|
52
|
+
value={digit}
|
|
53
|
+
onChange={(e) => setDigit(e.detail.value)}
|
|
54
|
+
/>
|
|
55
|
+
</Field>
|
|
56
|
+
<Field label="密码">
|
|
57
|
+
<Input
|
|
58
|
+
password
|
|
59
|
+
placeholder="请输入密码"
|
|
60
|
+
value={password}
|
|
61
|
+
onChange={(e) => setPassword(e.detail.value)}
|
|
62
|
+
/>
|
|
63
|
+
</Field>
|
|
64
|
+
</Cell.Group>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function DisabledField() {
|
|
69
|
+
return (
|
|
70
|
+
<Cell.Group inset>
|
|
71
|
+
<Field label="文本">
|
|
72
|
+
<Input placeholder="输入框只读" readonly value="输入框只读" />
|
|
73
|
+
</Field>
|
|
74
|
+
<Field label="文本">
|
|
75
|
+
<Input placeholder="输入框已禁用" disabled />
|
|
76
|
+
</Field>
|
|
77
|
+
</Cell.Group>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function IconField() {
|
|
82
|
+
return (
|
|
83
|
+
<Cell.Group inset>
|
|
84
|
+
<Field label="文本" icon={<SmileOutlined />} rightIcon={<WarningOutlined />}>
|
|
85
|
+
<Input placeholder="显示图标" />
|
|
86
|
+
</Field>
|
|
87
|
+
<Field label="文本" icon={<MusicOutlined />}>
|
|
88
|
+
<Input placeholder="显示清除图标" clearable />
|
|
89
|
+
</Field>
|
|
90
|
+
</Cell.Group>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function ErrorField() {
|
|
95
|
+
return (
|
|
96
|
+
<Cell.Group inset>
|
|
97
|
+
<Field label="用户名" required>
|
|
98
|
+
<Input placeholder="请输入用户名" color="danger" />
|
|
99
|
+
</Field>
|
|
100
|
+
<Field
|
|
101
|
+
required
|
|
102
|
+
label="手机号"
|
|
103
|
+
feedback={<Field.Feedback status="invalid">手机号格式错误</Field.Feedback>}
|
|
104
|
+
>
|
|
105
|
+
<Input placeholder="请输入手机号" />
|
|
106
|
+
</Field>
|
|
107
|
+
</Cell.Group>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function ButtonField() {
|
|
112
|
+
return (
|
|
113
|
+
<Cell.Group inset>
|
|
114
|
+
<Field align="center" label="短信验证码">
|
|
115
|
+
<Input placeholder="请输入短信验证码" />
|
|
116
|
+
<Button size="small" color="primary">
|
|
117
|
+
发送验证码
|
|
118
|
+
</Button>
|
|
119
|
+
</Field>
|
|
120
|
+
</Cell.Group>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function FieldWithInputAlign() {
|
|
125
|
+
return (
|
|
126
|
+
<Cell.Group inset>
|
|
127
|
+
<Field label="文本">
|
|
128
|
+
<Input align="left" placeholder="输入框内容左对齐" />
|
|
129
|
+
</Field>
|
|
130
|
+
<Field label="文本">
|
|
131
|
+
<Input align="center" placeholder="输入框内容居中对齐" />
|
|
132
|
+
</Field>
|
|
133
|
+
<Field label="文本">
|
|
134
|
+
<Input align="right" placeholder="输入框内容右对齐" />
|
|
135
|
+
</Field>
|
|
136
|
+
</Cell.Group>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function TextareaWithAutoHeight() {
|
|
141
|
+
const env = getEnv();
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
<Cell.Group inset style={{ "--textarea-line-height": env === "WEB" ? "1.2rem" : "1" }}>
|
|
146
|
+
<Field align="start" label="留言">
|
|
147
|
+
<Textarea autoHeight placeholder="请输入留言" />
|
|
148
|
+
</Field>
|
|
149
|
+
</Cell.Group>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function TextareaWithLimit() {
|
|
154
|
+
const env = getEnv();
|
|
155
|
+
return (
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
<Cell.Group inset style={{ "--textarea-line-height": env === "WEB" ? "1.2rem" : "1" }}>
|
|
158
|
+
<Field align="start" label="留言">
|
|
159
|
+
<Textarea style={{ height: "48px" }} limit={50} placeholder="请输入留言" />
|
|
160
|
+
</Field>
|
|
161
|
+
</Cell.Group>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export default function FieldDemo() {
|
|
166
|
+
return (
|
|
167
|
+
<Page title="Field 输入框" className="field-demo">
|
|
168
|
+
<Block title="基础用法">
|
|
169
|
+
<BasicField />
|
|
170
|
+
</Block>
|
|
171
|
+
<Block title="自定义类型">
|
|
172
|
+
<CustomField />
|
|
173
|
+
</Block>
|
|
174
|
+
<Block title="禁用输入框">
|
|
175
|
+
<DisabledField />
|
|
176
|
+
</Block>
|
|
177
|
+
<Block title="显示图标">
|
|
178
|
+
<IconField />
|
|
179
|
+
</Block>
|
|
180
|
+
<Block title="错误提示">
|
|
181
|
+
<ErrorField />
|
|
182
|
+
</Block>
|
|
183
|
+
<Block title="插入按钮">
|
|
184
|
+
<ButtonField />
|
|
185
|
+
</Block>
|
|
186
|
+
<Block title="高度自适应">
|
|
187
|
+
<CustomWrapper>
|
|
188
|
+
<TextareaWithAutoHeight />
|
|
189
|
+
</CustomWrapper>
|
|
190
|
+
</Block>
|
|
191
|
+
<Block title="显示字数统计">
|
|
192
|
+
<CustomWrapper>
|
|
193
|
+
<TextareaWithLimit />
|
|
194
|
+
</CustomWrapper>
|
|
195
|
+
</Block>
|
|
196
|
+
<Block title="输入框内容对齐">
|
|
197
|
+
<CustomWrapper>
|
|
198
|
+
<FieldWithInputAlign />
|
|
199
|
+
</CustomWrapper>
|
|
200
|
+
</Block>
|
|
201
|
+
</Page>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Flex Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| ------------ | ---------------- | ------------------ | ------------------------------- |
|
|
7
|
+
| open | 是否打开 | _boolean_ | `false` |
|
|
8
|
+
| data | 悬浮导航内数据 | _FixedNavItem[]_ | `[]` |
|
|
9
|
+
| backdrop | 是否显示遮罩层 | _boolean_ | `true` |
|
|
10
|
+
| activeText | 收起按钮文案 | _string_ | `收起导航` |
|
|
11
|
+
| inactiveText | 展开按钮文案 | _string_ | `快速导航` |
|
|
12
|
+
| type | 悬浮导航方向 | _left \| right_ | `right` |
|
|
13
|
+
| position | 悬浮导航垂直位置 | _FixedNavPosition_ | `{top: 'auto', bottom: 'auto'}` |
|
|
14
|
+
| content | 自定义按钮 | _ReactNode_ | `-` |
|
|
15
|
+
|
|
16
|
+
### Events
|
|
17
|
+
|
|
18
|
+
| 事件名 | 说明 | 回调参数 |
|
|
19
|
+
| -------- | ---------------- | ---------------- |
|
|
20
|
+
| onChange | 展开收起按钮回调 | _value: boolean_ |
|
|
21
|
+
| onClick | 选择之后触发 | _item_ |
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# FixedNav 悬浮导航
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
伸缩式交互,用于快捷导航
|
|
6
|
+
|
|
7
|
+
请升级 `taroify` 到 >= `v0.1.2-alpha.0` 版本来使用该组件。
|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { FixedNav } from "@fjyueke/bify-core"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 代码演示
|
|
16
|
+
|
|
17
|
+
### 基础用法
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
const list = [
|
|
21
|
+
{
|
|
22
|
+
id: 1,
|
|
23
|
+
text: "首页",
|
|
24
|
+
icon: <WapHomeOutlined />,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 2,
|
|
28
|
+
text: "分类",
|
|
29
|
+
icon: <AppsOutlined />,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 3,
|
|
33
|
+
text: "购物车",
|
|
34
|
+
num: 2,
|
|
35
|
+
icon: <ShoppingCartOutlined />,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 4,
|
|
39
|
+
text: "我的",
|
|
40
|
+
icon: <UserOutlined />,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
const App = () => {
|
|
45
|
+
const [open, setOpen] = useState(false)
|
|
46
|
+
|
|
47
|
+
return <FixedNav open={open} onChange={setOpen} data={list} position={{ top: "150px" }} />
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 位置在左侧
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
const list = [
|
|
55
|
+
{
|
|
56
|
+
id: 1,
|
|
57
|
+
text: "首页",
|
|
58
|
+
icon: <WapHomeOutlined />,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 2,
|
|
62
|
+
text: "分类",
|
|
63
|
+
icon: <AppsOutlined />,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 3,
|
|
67
|
+
text: "购物车",
|
|
68
|
+
num: 2,
|
|
69
|
+
icon: <ShoppingCartOutlined />,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 4,
|
|
73
|
+
text: "我的",
|
|
74
|
+
icon: <UserOutlined />,
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
const App = () => {
|
|
79
|
+
const [open, setOpen] = useState(false)
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<FixedNav
|
|
83
|
+
open={open2}
|
|
84
|
+
onChange={setOpen2}
|
|
85
|
+
data={list}
|
|
86
|
+
type="left"
|
|
87
|
+
backdrop={false}
|
|
88
|
+
position={{ top: "300px" }}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 自定义内容
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
const CustomerFixedNav = () => {
|
|
98
|
+
const [open, setOpen] = useState(false)
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<FixedNav
|
|
102
|
+
open={open}
|
|
103
|
+
onChange={setOpen}
|
|
104
|
+
type="left"
|
|
105
|
+
backdrop={false}
|
|
106
|
+
position={{ top: "400px" }}
|
|
107
|
+
content={
|
|
108
|
+
<>
|
|
109
|
+
<GiftOutlined color="#FFF" />
|
|
110
|
+
<span className="fixed-nav-text">{open ? "开" : "关"}</span>
|
|
111
|
+
</>
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
<ul className="taroify-fixed-nav_content customer">
|
|
115
|
+
<li className="taroify-fixed-nav_content_item">我</li>
|
|
116
|
+
<li className="taroify-fixed-nav_content_item">是</li>
|
|
117
|
+
<li className="taroify-fixed-nav_content_item">自</li>
|
|
118
|
+
<li className="taroify-fixed-nav_content_item">定</li>
|
|
119
|
+
<li className="taroify-fixed-nav_content_item">义</li>
|
|
120
|
+
</ul>
|
|
121
|
+
</FixedNav>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```scss
|
|
127
|
+
.fixed-nav-demo {
|
|
128
|
+
.fixed-nav-text {
|
|
129
|
+
color: #fff;
|
|
130
|
+
line-height: 26px;
|
|
131
|
+
width: 48px;
|
|
132
|
+
font-size: 24px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.taroify-fixed-nav_content {
|
|
136
|
+
&.customer {
|
|
137
|
+
border-radius: 0 50px 50px 0;
|
|
138
|
+
margin: 0;
|
|
139
|
+
padding-left: 160px;
|
|
140
|
+
padding-right: 40px;
|
|
141
|
+
right: auto;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&_item {
|
|
145
|
+
align-items: center;
|
|
146
|
+
color: #1a1a1a;
|
|
147
|
+
display: flex;
|
|
148
|
+
flex: 1;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
flex-shrink: 0;
|
|
151
|
+
height: 100%;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
min-width: 100px;
|
|
154
|
+
position: relative;
|
|
155
|
+
font-size: 28px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## API
|
|
162
|
+
|
|
163
|
+
### Flex Props
|
|
164
|
+
|
|
165
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
166
|
+
| ------------ | ---------------- | ------------------ | ------------------------------- |
|
|
167
|
+
| open | 是否打开 | _boolean_ | `false` |
|
|
168
|
+
| data | 悬浮导航内数据 | _FixedNavItem[]_ | `[]` |
|
|
169
|
+
| backdrop | 是否显示遮罩层 | _boolean_ | `true` |
|
|
170
|
+
| activeText | 收起按钮文案 | _string_ | `收起导航` |
|
|
171
|
+
| inactiveText | 展开按钮文案 | _string_ | `快速导航` |
|
|
172
|
+
| type | 悬浮导航方向 | _left \| right_ | `right` |
|
|
173
|
+
| position | 悬浮导航垂直位置 | _FixedNavPosition_ | `{top: 'auto', bottom: 'auto'}` |
|
|
174
|
+
| content | 自定义按钮 | _ReactNode_ | `-` |
|
|
175
|
+
|
|
176
|
+
### Events
|
|
177
|
+
|
|
178
|
+
| 事件名 | 说明 | 回调参数 |
|
|
179
|
+
| -------- | ---------------- | ---------------- |
|
|
180
|
+
| onChange | 展开收起按钮回调 | _value: boolean_ |
|
|
181
|
+
| onClick | 选择之后触发 | _item_ |
|
|
182
|
+
|
|
183
|
+
## 主题定制
|
|
184
|
+
|
|
185
|
+
### 样式变量
|
|
186
|
+
|
|
187
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
188
|
+
|
|
189
|
+
| 名称 | 默认值 | 描述 |
|
|
190
|
+
| ----------------------------- | ------------------------ | ---- |
|
|
191
|
+
| --fixed-nav-z-index | _1010_ | - |
|
|
192
|
+
| --fixed-nav-z-content-index | _1009_ | - |
|
|
193
|
+
| --fixed-nav-button-background | _var(--blue, $blue)_ | - |
|
|
194
|
+
| --fixed-nav-button-font-size | _12px \* $hd_ | - |
|
|
195
|
+
| --fixed-nav-background-color | _var(--white, $white)_ | - |
|
|
196
|
+
| --fixed-nav-color | _var(--gray-8, $gray-8)_ | - |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
import { FixedNav } from "@fjyueke/bify-core"
|
|
3
|
+
import {
|
|
4
|
+
WapHomeOutlined,
|
|
5
|
+
AppsOutlined,
|
|
6
|
+
ShoppingCartOutlined,
|
|
7
|
+
UserOutlined,
|
|
8
|
+
GiftOutlined,
|
|
9
|
+
} from "@fjyueke/bify-icons"
|
|
10
|
+
import Page from "../../../components/page"
|
|
11
|
+
import "./index.scss"
|
|
12
|
+
|
|
13
|
+
const CustomerFixedNav = () => {
|
|
14
|
+
const [open, setOpen] = useState(false)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<FixedNav
|
|
18
|
+
open={open}
|
|
19
|
+
onChange={setOpen}
|
|
20
|
+
type="left"
|
|
21
|
+
backdrop={false}
|
|
22
|
+
position={{ top: "400px" }}
|
|
23
|
+
content={
|
|
24
|
+
<>
|
|
25
|
+
<GiftOutlined color="#FFF" />
|
|
26
|
+
<span className="fixed-nav-text">{open ? "开" : "关"}</span>
|
|
27
|
+
</>
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
<ul className="taroify-fixed-nav_content customer">
|
|
31
|
+
<li className="taroify-fixed-nav_content_item">我</li>
|
|
32
|
+
<li className="taroify-fixed-nav_content_item">是</li>
|
|
33
|
+
<li className="taroify-fixed-nav_content_item">自</li>
|
|
34
|
+
<li className="taroify-fixed-nav_content_item">定</li>
|
|
35
|
+
<li className="taroify-fixed-nav_content_item">义</li>
|
|
36
|
+
</ul>
|
|
37
|
+
</FixedNav>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function BackTopDemo() {
|
|
42
|
+
const [open, setOpen] = useState(false)
|
|
43
|
+
const [open2, setOpen2] = useState(false)
|
|
44
|
+
const list = [
|
|
45
|
+
{
|
|
46
|
+
id: 1,
|
|
47
|
+
text: "首页",
|
|
48
|
+
icon: <WapHomeOutlined />,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 2,
|
|
52
|
+
text: "分类",
|
|
53
|
+
icon: <AppsOutlined />,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 3,
|
|
57
|
+
text: "购物车",
|
|
58
|
+
icon: <ShoppingCartOutlined />,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 4,
|
|
62
|
+
text: "我的",
|
|
63
|
+
icon: <UserOutlined />,
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
return (
|
|
67
|
+
<Page title="FixedNav 悬浮导航" className="fixed-nav-demo">
|
|
68
|
+
<FixedNav open={open} onChange={setOpen} data={list} position={{ top: "150px" }} />
|
|
69
|
+
<FixedNav
|
|
70
|
+
open={open2}
|
|
71
|
+
onChange={setOpen2}
|
|
72
|
+
data={list}
|
|
73
|
+
type="left"
|
|
74
|
+
backdrop={false}
|
|
75
|
+
position={{ top: "300px" }}
|
|
76
|
+
/>
|
|
77
|
+
<CustomerFixedNav />
|
|
78
|
+
</Page>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| ------------- | -------------------------------------------------- | --------- | ------- |
|
|
7
|
+
| position | 固定位置,可选值 `top` `bottom` | _string_ | - |
|
|
8
|
+
| safeArea | 安全区域,可选值 `top` `bottom` | _string_ | - |
|
|
9
|
+
| nativeSafeTop | 是否启用顶部安全区域原生属性 | _boolean_ | `false` |
|
|
10
|
+
| placeholder | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | - |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# FixedView 固定视图
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于固定在顶部或底部的视图。
|
|
6
|
+
|
|
7
|
+
## 代码演示
|
|
8
|
+
|
|
9
|
+
### 基础用法
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<FixedView position="top">固定在顶部</FixedView>
|
|
13
|
+
<FixedView position="bottom">固定在底部</FixedView>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
### Props
|
|
19
|
+
|
|
20
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
21
|
+
| ------------- | -------------------------------------------------- | --------- | ------- |
|
|
22
|
+
| position | 固定位置,可选值 `top` `bottom` | _string_ | - |
|
|
23
|
+
| safeArea | 安全区域,可选值 `top` `bottom` | _string_ | - |
|
|
24
|
+
| nativeSafeTop | 是否启用顶部安全区域原生属性 | _boolean_ | `false` |
|
|
25
|
+
| placeholder | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | - |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FixedView } from "@fjyueke/bify-core"
|
|
2
|
+
import Page from "../../../components/page"
|
|
3
|
+
|
|
4
|
+
import "./index.scss"
|
|
5
|
+
|
|
6
|
+
export default function FixedViewDemo() {
|
|
7
|
+
return (
|
|
8
|
+
<Page title="FixedView 固定视图" className="fixed-view-demo">
|
|
9
|
+
<FixedView position="bottom">固定在底部</FixedView>
|
|
10
|
+
</Page>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Flex Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| gutter | 列元素之间的间距(单位为 px) | _number_ | - |
|
|
8
|
+
| direction | 项目定位方向,可选值为 `row` `row-reverse` `column` `column-reverse` | _boolean_ | `row` |
|
|
9
|
+
| wrap | 子元素的换行方式,可选值为 `nowrap` `wrap` `wrap-reverse` | _boolean_ | `nowrap` |
|
|
10
|
+
| justify | 主轴对齐方式,可选值为 `start` `end` `center` `space-around` `space-between` | _string_ | `start` |
|
|
11
|
+
| align | 交叉轴对齐方式,可选值为 `start` `center` `end` `baseline` `stretch` | _string_ | `start` |
|
|
12
|
+
|
|
13
|
+
### Flex.Item Props
|
|
14
|
+
|
|
15
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
16
|
+
| ------ | -------------- | ------------------ | ------ |
|
|
17
|
+
| span | 列元素宽度 | _number_ | - |
|
|
18
|
+
| offset | 列元素偏移距离 | _number_ | - |
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Layout 布局
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
`Flex` 组件是 CSS `flex` 布局的一个封装。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Flex } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
`Flex` 组件提供了 `24列栅格`,通过在 `Flex.Item` 上添加 `span` 属性设置列所占的宽度百分比。此外,添加 `offset` 属性可以设置列的偏移宽度,计算方式与 span 相同。
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Flex>
|
|
21
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
22
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
23
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
24
|
+
</Flex>
|
|
25
|
+
|
|
26
|
+
<Flex>
|
|
27
|
+
<Flex.Item span={4}>span: 4</Flex.Item>
|
|
28
|
+
<Flex.Item span={10} offset={4}>
|
|
29
|
+
offset: 4, span: 10
|
|
30
|
+
</Flex.Item>
|
|
31
|
+
</Flex>
|
|
32
|
+
|
|
33
|
+
<Flex>
|
|
34
|
+
<Flex.Item offset={12} span={12}>
|
|
35
|
+
offset: 12, span: 12
|
|
36
|
+
</Flex.Item>
|
|
37
|
+
</Flex>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 设置列元素间距
|
|
41
|
+
|
|
42
|
+
通过 `gutter` 属性可以设置列元素之间的间距,默认间距为 0。
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<Flex gutter={20}>
|
|
46
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
47
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
48
|
+
<Flex.Item span={8}>span: 8</Flex.Item>
|
|
49
|
+
</Flex>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 对齐方式
|
|
53
|
+
|
|
54
|
+
通过 `justify` 属性可以设置主轴上内容的对齐方式,等价于 flex 布局中的 `justify-content` 属性。
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<!-- 居中 -->
|
|
58
|
+
<Flex justify="center">
|
|
59
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
60
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
61
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
62
|
+
</Flex>
|
|
63
|
+
|
|
64
|
+
<!-- 右对齐 -->
|
|
65
|
+
<Flex justify="end">
|
|
66
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
67
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
68
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
69
|
+
</Flex>
|
|
70
|
+
|
|
71
|
+
<!-- 两端对齐 -->
|
|
72
|
+
<Flex justify="space-between">
|
|
73
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
74
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
75
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
76
|
+
</Flex>
|
|
77
|
+
|
|
78
|
+
<!-- 每个元素的两侧间隔相等 -->
|
|
79
|
+
<Flex justify="space-around">
|
|
80
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
81
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
82
|
+
<Flex.Item span={6}>span: 6</Flex.Item>
|
|
83
|
+
</Flex>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
### Flex Props
|
|
89
|
+
|
|
90
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| gutter | 列元素之间的间距(单位为 px) | _number_ | - |
|
|
93
|
+
| direction | 项目定位方向,可选值为 `row` `row-reverse` `column` `column-reverse` | _boolean_ | `row` |
|
|
94
|
+
| wrap | 子元素的换行方式,可选值为 `nowrap` `wrap` `wrap-reverse` | _boolean_ | `nowrap` |
|
|
95
|
+
| justify | 主轴对齐方式,可选值为 `start` `end` `center` `space-around` `space-between` | _string_ | `start` |
|
|
96
|
+
| align | 交叉轴对齐方式,可选值为 `start` `center` `end` `baseline` `stretch` | _string_ | `start` |
|
|
97
|
+
|
|
98
|
+
### Flex.Item Props
|
|
99
|
+
|
|
100
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
101
|
+
| ------ | -------------- | ------------------ | ------ |
|
|
102
|
+
| span | 列元素宽度 | _number_ | - |
|
|
103
|
+
| offset | 列元素偏移距离 | _number_ | - |
|