sard-uniapp 1.19.2 → 1.19.3

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.
Files changed (216) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/components/accordion/README.md +91 -0
  3. package/components/accordion/accordion.vue +7 -0
  4. package/components/accordion-item/accordion-item.vue +9 -0
  5. package/components/action-sheet/README.md +85 -0
  6. package/components/action-sheet/action-sheet.vue +15 -0
  7. package/components/alert/README.md +74 -0
  8. package/components/alert/alert.vue +10 -0
  9. package/components/avatar/README.md +86 -0
  10. package/components/avatar/avatar.vue +8 -0
  11. package/components/back-top/README.md +134 -0
  12. package/components/back-top/back-top.vue +9 -0
  13. package/components/badge/README.md +95 -0
  14. package/components/badge/badge.vue +11 -0
  15. package/components/button/README.md +162 -0
  16. package/components/button/button.vue +46 -0
  17. package/components/calendar/README.md +94 -0
  18. package/components/calendar/calendar.vue +19 -0
  19. package/components/calendar-input/README.md +65 -0
  20. package/components/calendar-input/calendar-input.vue +31 -0
  21. package/components/calendar-popout/README.md +100 -0
  22. package/components/calendar-popout/calendar-popout.vue +25 -0
  23. package/components/card/README.md +82 -0
  24. package/components/card/card.vue +9 -0
  25. package/components/cascader/README.md +117 -0
  26. package/components/cascader/cascader.vue +13 -0
  27. package/components/cascader-input/README.md +51 -0
  28. package/components/cascader-input/cascader-input.vue +25 -0
  29. package/components/cascader-popout/README.md +53 -0
  30. package/components/cascader-popout/cascader-popout.vue +19 -0
  31. package/components/checkbox/README.md +185 -0
  32. package/components/checkbox/checkbox.vue +17 -0
  33. package/components/checkbox-group/checkbox-group.vue +15 -0
  34. package/components/checkbox-input/README.md +44 -0
  35. package/components/checkbox-input/checkbox-input.vue +22 -0
  36. package/components/checkbox-popout/README.md +52 -0
  37. package/components/checkbox-popout/checkbox-popout.vue +19 -0
  38. package/components/col/col.vue +7 -0
  39. package/components/collapse/README.md +45 -0
  40. package/components/collapse/collapse.vue +3 -0
  41. package/components/config/index.d.ts +2 -0
  42. package/components/config/index.js +1 -0
  43. package/components/count-down/README.md +97 -0
  44. package/components/count-down/count-down.vue +8 -0
  45. package/components/count-to/README.md +61 -0
  46. package/components/count-to/count-to.vue +7 -0
  47. package/components/crop-image/README.md +86 -0
  48. package/components/crop-image/crop-image.vue +15 -0
  49. package/components/datetime-picker/README.md +136 -0
  50. package/components/datetime-picker/datetime-picker.vue +14 -0
  51. package/components/datetime-picker-input/README.md +82 -0
  52. package/components/datetime-picker-input/datetime-picker-input.vue +25 -0
  53. package/components/datetime-picker-popout/README.md +77 -0
  54. package/components/datetime-picker-popout/datetime-picker-popout.vue +19 -0
  55. package/components/datetime-range-picker/README.md +49 -0
  56. package/components/datetime-range-picker/datetime-range-picker.vue +15 -0
  57. package/components/datetime-range-picker-input/README.md +58 -0
  58. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +26 -0
  59. package/components/datetime-range-picker-popout/README.md +53 -0
  60. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +20 -0
  61. package/components/dialog/README.md +192 -0
  62. package/components/dialog/dialog.vue +33 -0
  63. package/components/dialog-agent/dialog-agent.vue +21 -0
  64. package/components/divider/README.md +80 -0
  65. package/components/divider/divider.vue +8 -0
  66. package/components/dropdown/README.md +168 -0
  67. package/components/dropdown/common.d.ts +7 -0
  68. package/components/dropdown/common.js +1 -0
  69. package/components/dropdown/dropdown.vue +16 -1
  70. package/components/dropdown-item/dropdown-item.vue +51 -4
  71. package/components/empty/README.md +71 -0
  72. package/components/empty/empty.vue +8 -0
  73. package/components/fab/README.md +111 -0
  74. package/components/fab/fab.vue +18 -0
  75. package/components/floating-bubble/README.md +70 -0
  76. package/components/floating-bubble/floating-bubble.vue +11 -0
  77. package/components/floating-panel/README.md +78 -0
  78. package/components/floating-panel/floating-panel.vue +11 -0
  79. package/components/form/README.md +308 -0
  80. package/components/form/form.vue +19 -0
  81. package/components/form-item/form-item.vue +17 -0
  82. package/components/grid/README.md +140 -0
  83. package/components/grid/grid.vue +11 -0
  84. package/components/grid-item/grid-item.vue +15 -0
  85. package/components/icon/README.md +118 -0
  86. package/components/icon/common.d.ts +2 -0
  87. package/components/icon/icon.d.ts +1 -0
  88. package/components/icon/icon.vue +18 -3
  89. package/components/indexes/README.md +83 -0
  90. package/components/indexes/indexes.vue +7 -0
  91. package/components/indexes-anchor/indexes-anchor.vue +5 -0
  92. package/components/input/README.md +170 -0
  93. package/components/input/input.vue +55 -0
  94. package/components/keyboard/README.md +82 -0
  95. package/components/keyboard/keyboard.vue +7 -0
  96. package/components/layout/README.md +89 -0
  97. package/components/list/README.md +118 -0
  98. package/components/list/list.vue +8 -0
  99. package/components/list-item/list-item.vue +15 -0
  100. package/components/load-more/README.md +75 -0
  101. package/components/load-more/load-more.vue +11 -0
  102. package/components/loading/README.md +89 -0
  103. package/components/loading/loading.vue +13 -0
  104. package/components/lucky-draw/README.md +174 -0
  105. package/components/marquee/README.md +65 -0
  106. package/components/marquee/marquee.vue +7 -0
  107. package/components/menu/_README.md +61 -0
  108. package/components/navbar/README.md +123 -0
  109. package/components/navbar/navbar.vue +11 -0
  110. package/components/navbar-item/navbar-item.vue +10 -0
  111. package/components/notice-bar/README.md +135 -0
  112. package/components/notice-bar/notice-bar.vue +17 -0
  113. package/components/notify/README.md +118 -0
  114. package/components/notify/notify.vue +11 -0
  115. package/components/notify-agent/notify-agent.vue +12 -0
  116. package/components/overlay/README.md +56 -0
  117. package/components/overlay/overlay.vue +10 -0
  118. package/components/pagination/README.md +80 -0
  119. package/components/pagination/pagination.vue +15 -0
  120. package/components/password-input/README.md +87 -0
  121. package/components/password-input/password-input.vue +17 -0
  122. package/components/picker/README.md +115 -0
  123. package/components/picker/picker.vue +10 -0
  124. package/components/picker-input/README.md +51 -0
  125. package/components/picker-input/picker-input.vue +21 -0
  126. package/components/picker-popout/README.md +51 -0
  127. package/components/picker-popout/picker-popout.vue +15 -0
  128. package/components/popout/README.md +111 -0
  129. package/components/popout/popout.vue +29 -0
  130. package/components/popout-input/README.md +55 -0
  131. package/components/popout-input/popout-input.vue +15 -0
  132. package/components/popover/README.md +191 -0
  133. package/components/popover/popover.vue +15 -0
  134. package/components/popover-reference/popover-reference.vue +5 -0
  135. package/components/popup/README.md +67 -0
  136. package/components/popup/popup.vue +20 -0
  137. package/components/progress-bar/README.md +90 -0
  138. package/components/progress-bar/progress-bar.vue +13 -0
  139. package/components/progress-circle/README.md +75 -0
  140. package/components/progress-circle/progress-circle.vue +10 -0
  141. package/components/pull-down-refresh/README.md +100 -0
  142. package/components/pull-down-refresh/pull-down-refresh.vue +11 -0
  143. package/components/qrcode/README.md +103 -0
  144. package/components/qrcode/qrcode.vue +13 -0
  145. package/components/radio/README.md +172 -0
  146. package/components/radio/radio.vue +13 -0
  147. package/components/radio-group/radio-group.vue +16 -0
  148. package/components/radio-input/README.md +44 -0
  149. package/components/radio-input/radio-input.vue +23 -0
  150. package/components/radio-popout/README.md +52 -0
  151. package/components/radio-popout/radio-popout.vue +20 -0
  152. package/components/rate/README.md +106 -0
  153. package/components/rate/rate.vue +22 -0
  154. package/components/result/README.md +66 -0
  155. package/components/result/result.vue +10 -0
  156. package/components/row/row.vue +7 -0
  157. package/components/scroll-spy/README.md +70 -0
  158. package/components/scroll-spy/scroll-spy.vue +13 -0
  159. package/components/search/README.md +117 -0
  160. package/components/search/search.vue +25 -0
  161. package/components/share-sheet/README.md +94 -0
  162. package/components/share-sheet/share-sheet.vue +20 -0
  163. package/components/sidebar/README.md +118 -0
  164. package/components/sidebar/sidebar.vue +10 -0
  165. package/components/sidebar-item/sidebar-item.vue +8 -0
  166. package/components/signature/README.md +99 -0
  167. package/components/signature/signature.vue +20 -0
  168. package/components/skeleton/README.md +128 -0
  169. package/components/skeleton/skeleton.vue +12 -0
  170. package/components/skeleton-avatar/skeleton-avatar.vue +9 -0
  171. package/components/skeleton-block/skeleton-block.vue +8 -0
  172. package/components/skeleton-paragraph/skeleton-paragraph.vue +9 -0
  173. package/components/skeleton-title/skeleton-title.vue +8 -0
  174. package/components/slider/README.md +140 -0
  175. package/components/slider/slider.vue +29 -0
  176. package/components/space/README.md +82 -0
  177. package/components/space/space.vue +9 -0
  178. package/components/status-bar/README.md +72 -0
  179. package/components/status-bar/status-bar.vue +6 -0
  180. package/components/step/step.vue +9 -1
  181. package/components/stepper/README.md +94 -0
  182. package/components/stepper/stepper.vue +24 -0
  183. package/components/steps/README.md +142 -0
  184. package/components/steps/steps.vue +15 -0
  185. package/components/style/README.md +20 -0
  186. package/components/swipe-action/README.md +82 -0
  187. package/components/swipe-action/swipe-action.vue +7 -0
  188. package/components/swiper-dot/README.md +45 -0
  189. package/components/swiper-dot/swiper-dot.vue +9 -0
  190. package/components/switch/README.md +89 -0
  191. package/components/switch/switch.vue +18 -0
  192. package/components/tab/tab.vue +8 -0
  193. package/components/tabbar/README.md +111 -0
  194. package/components/tabbar/tabbar.vue +12 -0
  195. package/components/tabbar-item/tabbar-item.vue +12 -0
  196. package/components/tabbar-pit/README.md +41 -0
  197. package/components/tabbar-pit/tabbar-pit.vue +5 -0
  198. package/components/table/README.md +162 -0
  199. package/components/table/table.vue +7 -0
  200. package/components/table-cell/table-cell.vue +7 -0
  201. package/components/table-row/table-row.vue +5 -0
  202. package/components/tabs/README.md +113 -0
  203. package/components/tabs/tabs.vue +10 -0
  204. package/components/tag/README.md +96 -0
  205. package/components/tag/tag.vue +14 -0
  206. package/components/timeline/README.md +66 -0
  207. package/components/timeline/timeline.vue +4 -0
  208. package/components/timeline-item/timeline-item.vue +9 -0
  209. package/components/toast/README.md +111 -0
  210. package/components/toast/toast.vue +11 -0
  211. package/components/toast-agent/toast-agent.vue +11 -0
  212. package/components/tree/README.md +208 -0
  213. package/components/tree/tree.vue +21 -0
  214. package/components/upload/README.md +154 -0
  215. package/components/upload/upload.vue +22 -0
  216. package/package.json +74 -45
@@ -26,6 +26,17 @@ import {
26
26
  } from "./common";
27
27
  import { useTranslate } from "../locale";
28
28
  import SarLoading from "../loading/loading.vue";
29
+ /**
30
+ * @property {string} rootClass 组件根元素类名,默认值:-。
31
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
32
+ * @property {LoadMoreStatus} status 加载的状态,默认值:'incomplete'。
33
+ * @property {string} incompleteText 未加载完的状态文本,默认值:'加载更多'。
34
+ * @property {string} loadingText 加载中的状态文本,默认值:'加载中...'。
35
+ * @property {string} completeText 加载完的状态文本,默认值:'没有更多了'。
36
+ * @property {string} errorText 加载错误的状态文本,默认值:'请求失败,点击重新加载'。
37
+ * @event {() => void} load-more 在 `incomplete` 状态下点击时触发
38
+ * @event {() => void} reload 在 `error` 状态下点击时触发
39
+ */
29
40
  export default _defineComponent({
30
41
  components: {
31
42
  SarLoading,
@@ -0,0 +1,89 @@
1
+ ---
2
+ nav: 组件
3
+ title: Loading
4
+ subtitle: 加载
5
+ group: 反馈组件
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 表示处理中的状态。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Button from 'sard-uniapp/components/loading/loading.vue'
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ### 基础使用
21
+
22
+ @code('${DEMO_PATH}/loading/demo/Basic.vue')
23
+
24
+ ### 加载类型
25
+
26
+ 使用`type`属性设置不同类型。
27
+
28
+ @code('${DEMO_PATH}/loading/demo/Type.vue')
29
+
30
+ ### 加载文案
31
+
32
+ 通过`text`属性或者默认插槽展示文字。
33
+
34
+ @code('${DEMO_PATH}/loading/demo/Text.vue')
35
+
36
+ ### 垂直排布
37
+
38
+ 通过`vertical`属性设置图标和文字垂直排布。
39
+
40
+ @code('${DEMO_PATH}/loading/demo/Vertical.vue')
41
+
42
+ ### 加载尺寸
43
+
44
+ `size`属性设置图标大小,`textSize`属性设置文字大小。
45
+
46
+ @code('${DEMO_PATH}/loading/demo/Size.vue')
47
+
48
+ ### 自定义颜色
49
+
50
+ `color`属性设置图标颜色,`textColor`属性设置文字颜色。
51
+
52
+ @code('${DEMO_PATH}/loading/demo/Color.vue')
53
+
54
+ ### 自定义图标
55
+
56
+ 通过 `circular` 插槽可以自定义加载图标。
57
+
58
+ @code('${DEMO_PATH}/loading/demo/Custom.vue')
59
+
60
+ ## API
61
+
62
+ ### LoadingProps
63
+
64
+ | 属性 | 描述 | 类型 | 默认值 |
65
+ | ---------- | ---------------------- | --------------------- | ---------- |
66
+ | root-class | 组件根元素类名 | string | - |
67
+ | root-style | 组件根元素样式 | StyleValue | - |
68
+ | type | 加载类型 | 'clock' \| 'circular' | 'circular' |
69
+ | color | 加载颜色 | string | - |
70
+ | size | 图标尺寸 | string | - |
71
+ | text | 图标文字 | string | - |
72
+ | text-color | 文字颜色 | string | - |
73
+ | text-size | 文字尺寸 | string | - |
74
+ | vertical | 是否垂直排列图标和文案 | boolean | false |
75
+ | animated | 是否开启加载动画 | boolean | true |
76
+ | progress | 当前加载的进度 | number | 1 |
77
+
78
+ ### LoadingSlots
79
+
80
+ | 插槽 | 描述 | 属性 |
81
+ | -------- | ---------------------------- | ---- |
82
+ | default | 自定义加载文字内容 | - |
83
+ | circular | 自定义 `circular` 类型的图标 | - |
84
+
85
+ ## 主题定制
86
+
87
+ ### CSS 变量
88
+
89
+ @code('./variables.scss#variables')
@@ -47,6 +47,19 @@ import {
47
47
  import {
48
48
  defaultLoadingProps
49
49
  } from "./common";
50
+ /**
51
+ * @property {string} rootClass 组件根元素类名,默认值:-。
52
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
53
+ * @property {'clock' | 'circular'} type 加载类型,默认值:'circular'。
54
+ * @property {string} color 加载颜色,默认值:-。
55
+ * @property {string} size 图标尺寸,默认值:-。
56
+ * @property {string} text 图标文字,默认值:-。
57
+ * @property {string} textColor 文字颜色,默认值:-。
58
+ * @property {string} textSize 文字尺寸,默认值:-。
59
+ * @property {boolean} vertical 是否垂直排列图标和文案,默认值:false。
60
+ * @property {boolean} animated 是否开启加载动画,默认值:true。
61
+ * @property {number} progress 当前加载的进度,默认值:1。
62
+ */
50
63
  export default _defineComponent({
51
64
  ...{
52
65
  options: {
@@ -0,0 +1,174 @@
1
+ ---
2
+ nav: 组件
3
+ title: LuckyDraw
4
+ subtitle: 幸运抽奖
5
+ group:
6
+ title: 活动组件
7
+ order: 6
8
+ version: 1.2+
9
+ ---
10
+
11
+ ## 介绍
12
+
13
+ 提供了几个组合式函数,封装了九宫格、幸运大转盘、老虎机等抽奖的主要逻辑。布局与样式需自行实现,可拷贝案例代码再进行修改。
14
+
15
+ ## 引入
16
+
17
+ ```ts
18
+ import { useLuckyGrid, useLuckyWheel, useSlotMachine } from 'sard-uniapp'
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 九宫格
24
+
25
+ 遍历 `useLuckyGrid` 返回的 `grids` 计算属性来渲染九宫格;`activeIndex` 计算属性用于判断当前活动的奖品。
26
+
27
+ 点击按钮后调用 `play` 方法开始动画;
28
+
29
+ 在确定抽中的奖品下标时调用 `stop` 方法开始减速动画;
30
+
31
+ 在动画完全停止后调用 `complete` 回调函数展示抽中的奖品。
32
+
33
+ @code('${DEMO_PATH}/lucky-draw/demo/BasicGrid.vue')
34
+
35
+ utils.ts
36
+
37
+ @code('${DEMO_PATH}/lucky-draw/demo/utils.ts')
38
+
39
+ ### 自定义宫格行列
40
+
41
+ `useLuckyGrid` 默认会生成 3x3 个格子,也可以自定义行列数。
42
+
43
+ 宫格的外边缘格子下标从左上角以 0 开始逆时针递增,内部的格子下标从左到右、从上到下以 -1 开始递减。
44
+
45
+ `centerSize` 计算属性可用于获取中间格子的行列数。
46
+
47
+ @code('${DEMO_PATH}/lucky-draw/demo/GridSize.vue')
48
+
49
+ ### 大转盘
50
+
51
+ 大转盘与宫格抽奖逻辑类似。
52
+
53
+ `count` 选项用于指定奖品数量;
54
+
55
+ `useLuckyWheel` 函数返回的 `sectorDegrees` 计算属性为每个奖品所占的角度;
56
+
57
+ `degrees` 计算属性为整个大转盘当前旋转的角度。
58
+
59
+ @code('${DEMO_PATH}/lucky-draw/demo/Wheel.vue')
60
+
61
+ ### 老虎机
62
+
63
+ 老虎机可以一次性抽取多个奖品。
64
+
65
+ `columns` 选项用于指定列数以及每列的奖品数量;
66
+
67
+ `offset` 计算属性保存着每一列的百分比偏移量,每一列奖品容器的高度需和奖品高度一致;
68
+
69
+ 为了实现首位相接的效果,还需在渲染的奖品列表的末尾加上第一个奖品。
70
+
71
+ @code('${DEMO_PATH}/lucky-draw/demo/SlotMechine.vue')
72
+
73
+ ## API
74
+
75
+ ### useLuckyGrid
76
+
77
+ ```ts
78
+ function useLuckyGrid(options?: UseLuckyGridOptions): UseLuckyGridReturn
79
+ ```
80
+
81
+ ### UseLuckyGridOptions
82
+
83
+ | 属性 | 描述 | 类型 | 默认值 |
84
+ | ---------- | ------------------------------ | ---------------------------- | ------------------- |
85
+ | row | 宫格行数 | number \| Ref\<number> | 3 |
86
+ | column | 宫格列数 | number \| Ref\<number> | 3 |
87
+ | minSpeed | 最小加速度 | number \| Ref\<number> | 0.1 |
88
+ | maxSpeed | 最大加速度 | number \| Ref\<number> | 0.4 |
89
+ | accelTime | 加速时间,单位毫秒 | number \| Ref\<number> | 2500 |
90
+ | decelTime | 减速时间,单位毫秒 | number \| Ref\<number> | 2500 |
91
+ | easeIn | 加速缓动公式 | (progress: number) => number | (k) => k \* k |
92
+ | easeOut | 减速缓动公式 | (progress: number) => number | (k) => k \* (2 - k) |
93
+ | startDelay | 加速运动前的等待时间,单位毫秒 | number \| Ref\<number> | 0 |
94
+ | endDelay | 减速运动后的等待时间,单位毫秒 | number \| Ref\<number> | 500 |
95
+ | complete | 完成抽奖动画后的回调 | (index: number) => void | - |
96
+
97
+ ### UseLuckyGridReturn
98
+
99
+ | 属性 | 描述 | 类型 |
100
+ | ----------- | ---------------------------------------------- | ---------------------------------------------- |
101
+ | play | 调用后开始抽奖 | () => void |
102
+ | stop | 调用后开始减速动画 | (index?: number) => void |
103
+ | pause | 调用后暂停动画 | () => void |
104
+ | reset | 调用后重置动画 | () => void |
105
+ | playing | 用于判断当前是否正在动画 | ComputedRef\<boolean> |
106
+ | activeIndex | 用于判断当前活动的下标 | ComputedRef\<number \| undefined> |
107
+ | grids | 用于渲染成宫格,并根据下标判断奖品和非奖品位置 | ComputedRef\<number[]> |
108
+ | centerSize | 用于渲染中间非奖品格子的行列数 | ComputedRef\<{ row: number; column: number; }> |
109
+
110
+ ### useLuckyWheel
111
+
112
+ ```ts
113
+ function useLuckyWheel(options?: UseLuckyWheelOptions): UseLuckyWheelReturn
114
+ ```
115
+
116
+ ### UseLuckyWheelOptions
117
+
118
+ | 属性 | 描述 | 类型 | 默认值 |
119
+ | ---------- | ------------------------------ | ---------------------------- | ------------------- |
120
+ | count | 奖品个数 | number \| Ref\<number> | 8 |
121
+ | minSpeed | 最小加速度 | number \| Ref\<number> | 0.01 |
122
+ | maxSpeed | 最大加速度 | number \| Ref\<number> | 0.4 |
123
+ | accelTime | 加速时间,单位毫秒 | number \| Ref\<number> | 2500 |
124
+ | decelTime | 减速时间,单位毫秒 | number \| Ref\<number> | 2500 |
125
+ | easeIn | 加速缓动公式 | (progress: number) => number | (k) => k \* k |
126
+ | easeOut | 减速缓动公式 | (progress: number) => number | (k) => k \* (2 - k) |
127
+ | startDelay | 加速运动前的等待时间,单位毫秒 | number \| Ref\<number> | 0 |
128
+ | endDelay | 减速运动后的等待时间,单位毫秒 | number \| Ref\<number> | 300 |
129
+ | complete | 完成抽奖动画后的回调 | (index: number) => void | - |
130
+
131
+ ### UseLuckyWheelReturn
132
+
133
+ | 属性 | 描述 | 类型 |
134
+ | ------------- | -------------------------------- | ------------------------ |
135
+ | play | 调用后开始抽奖 | () => void |
136
+ | stop | 调用后开始减速动画 | (index?: number) => void |
137
+ | pause | 调用后暂停动画 | () => void |
138
+ | reset | 调用后重置动画 | () => void |
139
+ | playing | 用于判断当前是否正在动画 | ComputedRef\<boolean> |
140
+ | sectorDegrees | 每个扇形奖品所占的角度,单位 deg | ComputedRef\<number> |
141
+ | degrees | 当前转盘渲染的角度,单位 deg | ComputedRef\<number> |
142
+
143
+ ### useSlotMachine
144
+
145
+ ```ts
146
+ function useSlotMachine(options: UseSlotMachineOptions): UseSlotMachineReturn
147
+ ```
148
+
149
+ ### UseSlotMachineOptions
150
+
151
+ | 属性 | 描述 | 类型 | 默认值 |
152
+ | ------------ | ------------------------------ | -------------------------------------------------------- | ------------------- |
153
+ | columns | 奖品个数 | number[] \| unknown[][] \| Ref\<number[] \| unknown[][]> | [] |
154
+ | staggerDelay | 列间交错延迟时间,单位毫秒 | number \| Ref\<number> | 600 |
155
+ | minSpeed | 最小加速度 | number \| Ref\<number> | 0.01 |
156
+ | maxSpeed | 最大加速度 | number \| Ref\<number> | 0.3 |
157
+ | accelTime | 加速时间,单位毫秒 | number \| Ref\<number> | 2500 |
158
+ | decelTime | 减速时间,单位毫秒 | number \| Ref\<number> | 2500 |
159
+ | easeIn | 加速缓动公式 | (progress: number) => number | (k) => k \* k |
160
+ | easeOut | 减速缓动公式 | (progress: number) => number | (k) => k \* (2 - k) |
161
+ | startDelay | 加速运动前的等待时间,单位毫秒 | number \| Ref\<number> | 0 |
162
+ | endDelay | 减速运动后的等待时间,单位毫秒 | number \| Ref\<number> | 300 |
163
+ | complete | 完成抽奖动画后的回调 | (index: number[]) => void | - |
164
+
165
+ ### UseSlotMachineReturn
166
+
167
+ | 属性 | 描述 | 类型 |
168
+ | ------- | ------------------------ | -------------------------- |
169
+ | play | 调用后开始抽奖 | () => void |
170
+ | stop | 调用后开始减速动画 | (index?: number[]) => void |
171
+ | pause | 调用后暂停动画 | () => void |
172
+ | reset | 调用后重置动画 | () => void |
173
+ | playing | 用于判断当前是否正在动画 | ComputedRef\<boolean> |
174
+ | offset | 每一列的当前偏移量 | ComputedRef\<number[]> |
@@ -0,0 +1,65 @@
1
+ ---
2
+ nav: 组件
3
+ title: Marquee
4
+ subtitle: 跑马灯
5
+ group: 活动组件
6
+ version: 1.2+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 让文字无缝循环滚动。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import Marquee from 'sard-uniapp/components/marquee/marquee.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 为了实现无缝的循环滚动,需要提供两份数据。
24
+
25
+ @code('${DEMO_PATH}/marquee/demo/Basic.vue')
26
+
27
+ ### 异步数据
28
+
29
+ `Marquee` 组件是通过 `animation` 来实现高效的滚动动画的,
30
+ 会根据内容高度或宽度动态设置动画时长,以实现固定速率滚动。
31
+
32
+ 如果 `Marquee` 挂载时机比插槽内容靠前,即插槽内容数据需要通过接口异步获取再渲染的,
33
+ 需要手动调用 `update` 方法来更新动画时长。
34
+
35
+ @code('${DEMO_PATH}/marquee/demo/Reset.vue')
36
+
37
+ ### 水平方向
38
+
39
+ 可以设置 `direction="horizontal"` 属性实现水平方向的滚动。
40
+
41
+ @code('${DEMO_PATH}/marquee/demo/Horizontal.vue')
42
+
43
+ ## API
44
+
45
+ ### MarqueeProps
46
+
47
+ | 属性 | 描述 | 类型 | 默认值 |
48
+ | ---------- | --------------------------------------------------- | -------------------------- | ---------- |
49
+ | root-class | 组件根元素类名 | string | - |
50
+ | root-style | 组件根元素样式 | StyleValue | - |
51
+ | direction | 动画滚动方向 | 'vertical' \| 'horizontal' | 'vertical' |
52
+ | speed | 滚动速率 (px/s) | number | 50 |
53
+ | delay | 挂载后,延迟动画时间(单位 ms),避免进入页面时卡顿 | number | 1000 |
54
+
55
+ ### MarqueeSlots
56
+
57
+ | 插槽 | 描述 | 属性 |
58
+ | ------- | -------------- | ---- |
59
+ | default | 自定义默认内容 | - |
60
+
61
+ ### MarqueeExpose
62
+
63
+ | 属性 | 描述 | 类型 |
64
+ | ------ | ------------ | ---------- |
65
+ | update | 重置滚动时长 | () => void |
@@ -20,6 +20,13 @@ import {
20
20
  defaultMarqueeProps
21
21
  } from "./common";
22
22
  import { useTimeout } from "../../use";
23
+ /**
24
+ * @property {string} rootClass 组件根元素类名,默认值:-。
25
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
26
+ * @property {'vertical' | 'horizontal'} direction 动画滚动方向,默认值:'vertical'。
27
+ * @property {number} speed 滚动速率 (px/s),默认值:50。
28
+ * @property {number} delay 挂载后,延迟动画时间(单位 ms),避免进入页面时卡顿,默认值:1000。
29
+ */
23
30
  export default _defineComponent({
24
31
  ...{
25
32
  options: {
@@ -0,0 +1,61 @@
1
+ ---
2
+ nav: 组件
3
+ title: Menu
4
+ subtitle: 菜单
5
+ ---
6
+
7
+ ## 介绍
8
+
9
+ 气泡弹出框的中的菜单。
10
+
11
+ ## 引入
12
+
13
+ ```ts
14
+ import Menu from 'sard-uniapp/components/menu/menu.vue'
15
+ ```
16
+
17
+ ## API
18
+
19
+ ### MenuProps
20
+
21
+ | 属性 | 描述 | 类型 | 默认值 |
22
+ | --------- | ------------ | -------------------------- | ---------- |
23
+ | options | 菜单选项 | MenuOption[] | [] |
24
+ | direction | 菜单排列方向 | 'vertical' \| 'horizontal' | 'vertical' |
25
+ | theme | 菜单主题色 | 'dark' \| 'light' | 'light' |
26
+
27
+ ### MenuOption
28
+
29
+ | 属性 | 描述 | 类型 |
30
+ | ---------- | ---------- | ------- |
31
+ | text | 菜单项文案 | string |
32
+ | disabled | 禁用菜单项 | boolean |
33
+ | icon | 图标名称 | string |
34
+ | iconFamily | 图标字体 | string |
35
+
36
+ ### MenuEmits
37
+
38
+ | 事件 | 描述 | 类型 |
39
+ | ------ | ---------------- | ---------------------------- |
40
+ | select | 选择菜单项时触发 | (option: MenuOption) => void |
41
+
42
+ ### MenuItemProps
43
+
44
+ | 属性 | 描述 | 类型 | 默认值 |
45
+ | ----------- | ---------- | ------- | ------ |
46
+ | text | 菜单项文案 | string | - |
47
+ | disabled | 禁用菜单项 | boolean | false |
48
+ | icon | 图标名称 | string | - |
49
+ | icon-family | 图标字体 | string | - |
50
+
51
+ ### MenuItemEmits
52
+
53
+ | 事件 | 描述 | 类型 |
54
+ | ----- | ---------------- | -------------------- |
55
+ | click | 点击菜单项时触发 | (event: any) => void |
56
+
57
+ ## 主题定制
58
+
59
+ ### CSS 变量
60
+
61
+ @code('./variables.scss#variables')
@@ -0,0 +1,123 @@
1
+ ---
2
+ nav: 组件
3
+ title: Navbar
4
+ subtitle: 头部导航
5
+ group: 导航组件
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 在页面顶部的导航栏。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Navbar from 'sard-uniapp/components/navbar/navbar.vue'
16
+ import NavbarItem from 'sard-uniapp/components/navbar-item/navbar-item.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ 使用 `title` 显示居中的标题。
24
+
25
+ @code('${DEMO_PATH}/navbar/demo/Basic.vue')
26
+
27
+ ### 返回按钮
28
+
29
+ 设置 `show-back` 显示返回按钮,设置 `back-text` 显示返回文本。
30
+
31
+ @code('${DEMO_PATH}/navbar/demo/Back.vue')
32
+
33
+ ### 导航项
34
+
35
+ 可以在 `left/right` 插槽中放置导航项。导航项带有默认的颜色和点击态。
36
+
37
+ 内置的返回按钮也是使用导航项实现的。
38
+
39
+ @code('${DEMO_PATH}/navbar/demo/Item.vue')
40
+
41
+ ### 流动导航
42
+
43
+ 默认情况下标题居中, `left/right` 绝对定位于左右两侧;可以使用 `flow` 使其变为流动布局。
44
+
45
+ @code('${DEMO_PATH}/navbar/demo/Flow.vue')
46
+
47
+ ### 自定义内容
48
+
49
+ 默认插槽的内容会覆盖标题,可以实现更加自由的布局。
50
+
51
+ @code('${DEMO_PATH}/navbar/demo/Content.vue')
52
+
53
+ ### 背景色
54
+
55
+ 使用 css 变量 `--sar-navbar-bg` 设置想要的背景色,例如全屏时设置背景透明。
56
+
57
+ @code('${DEMO_PATH}/navbar/demo/Background.vue')
58
+
59
+ ### 文本颜色
60
+
61
+ 使用 css 变量 `--sar-navbar-item-color` 和 `--sar-navbar-title-color` 设置导航项颜色和标题颜色。
62
+
63
+ @code('${DEMO_PATH}/navbar/demo/Color.vue')
64
+
65
+ ## API
66
+
67
+ ### NavbarProps
68
+
69
+ | 属性 | 描述 | 类型 | 默认值 |
70
+ | --------------------------- | ---------------------------------------------------------------------------------- | ---------- | ------ |
71
+ | root-class | 组件根元素类名 | string | - |
72
+ | root-style | 组件根元素样式 | StyleValue | - |
73
+ | title | 自定义标题 | string | - |
74
+ | flow | 默认 `left/right` 绝对定位于左右两侧,标题居中;可以使用 `flow` 使其变为流动布局。 | boolean | false |
75
+ | show-back <sup>1.12+</sup> | 是否显示返回按钮(仅显示,返回逻辑需自行编写) | boolean | false |
76
+ | back-text <sup>1.12+</sup> | 返回按钮的文本 | string | - |
77
+ | fixed <sup>1.12+</sup> | 是否固定到页面顶部 | boolean | false |
78
+ | status-bar <sup>1.12+</sup> | 是否包含状态栏 | boolean | false |
79
+
80
+ ### NavbarSlots
81
+
82
+ | 插槽 | 描述 | 属性 |
83
+ | ------- | ---------------------- | ---- |
84
+ | default | 自定义导航中间内容 | - |
85
+ | title | 自定义标题内容 | - |
86
+ | left | 自定义导航左侧区域内容 | - |
87
+ | right | 自定义导航右侧区域内容 | - |
88
+
89
+ ### NavbarEmits
90
+
91
+ | 事件 | 描述 | 类型 |
92
+ | ---- | -------------------- | -------------------- |
93
+ | back | 点击返回按钮项时触发 | (event: any) => void |
94
+
95
+ ### NavbarItemProps
96
+
97
+ | 属性 | 描述 | 类型 | 默认值 |
98
+ | ---------------------------- | -------------------------------- | ---------- | ------ |
99
+ | root-class | 组件根元素类名 | string | - |
100
+ | root-style | 组件根元素样式 | StyleValue | - |
101
+ | text <sup>1.12+</sup> | 导航项文本 | string | - |
102
+ | icon <sup>1.12+</sup> | 导航项图标 | string | - |
103
+ | icon-family <sup>1.12+</sup> | 导航项图标字体名称 | string | - |
104
+ | icon-size <sup>1.12+</sup> | 导航项图标大小 | string | - |
105
+ | reverse <sup>1.12+</sup> | 默认图标在文本前面,可以互换位置 | string | false |
106
+
107
+ ### NavbarItemSlots
108
+
109
+ | 插槽 | 描述 | 属性 |
110
+ | ------- | -------------- | ---- |
111
+ | default | 自定义默认内容 | - |
112
+
113
+ ### NavbarItemEmits
114
+
115
+ | 事件 | 描述 | 类型 |
116
+ | ----- | ---------------- | -------------------- |
117
+ | click | 点击导航项时触发 | (event: any) => void |
118
+
119
+ ## 主题定制
120
+
121
+ ### CSS 变量
122
+
123
+ @code('./variables.scss#variables')
@@ -37,6 +37,17 @@ import { classNames, stringifyStyle, createBem } from "../../utils";
37
37
  import SarNavbarItem from "../navbar-item/navbar-item.vue";
38
38
  import SarStatusBar from "../status-bar/status-bar.vue";
39
39
  import SarNavbarPit from "../navbar-pit/navbar-pit.vue";
40
+ /**
41
+ * @property {string} rootClass 组件根元素类名,默认值:-。
42
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
43
+ * @property {string} title 自定义标题,默认值:-。
44
+ * @property {boolean} flow 默认 `left/right` 绝对定位于左右两侧,标题居中;可以使用 `flow` 使其变为流动布局。,默认值:false。
45
+ * @property {boolean} showBack 是否显示返回按钮(仅显示,返回逻辑需自行编写),默认值:false。
46
+ * @property {string} backText 返回按钮的文本,默认值:-。
47
+ * @property {boolean} fixed 是否固定到页面顶部,默认值:false。
48
+ * @property {boolean} statusBar 是否包含状态栏,默认值:false。
49
+ * @event {(event: any) => void} back 点击返回按钮项时触发
50
+ */
40
51
  export default _defineComponent({
41
52
  components: {
42
53
  SarNavbarItem,
@@ -23,6 +23,16 @@ import { defineComponent as _defineComponent } from "vue";
23
23
  import { computed } from "vue";
24
24
  import { classNames, stringifyStyle, createBem } from "../../utils";
25
25
  import SarIcon from "../icon/icon.vue";
26
+ /**
27
+ * @property {string} rootClass 组件根元素类名,默认值:-。
28
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
29
+ * @property {string} text 导航项文本,默认值:-。
30
+ * @property {string} icon 导航项图标,默认值:-。
31
+ * @property {string} iconFamily 导航项图标字体名称,默认值:-。
32
+ * @property {string} iconSize 导航项图标大小,默认值:-。
33
+ * @property {string} reverse 默认图标在文本前面,可以互换位置,默认值:false。
34
+ * @event {(event: any) => void} click 点击导航项时触发
35
+ */
26
36
  export default _defineComponent({
27
37
  components: {
28
38
  SarIcon,