sard-uniapp 1.19.2 → 1.19.4

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 (218) hide show
  1. package/CHANGELOG.md +19 -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 +97 -0
  18. package/components/calendar/calendar.vue +29 -1
  19. package/components/calendar/common.d.ts +6 -0
  20. package/components/calendar-input/README.md +65 -0
  21. package/components/calendar-input/calendar-input.vue +40 -0
  22. package/components/calendar-month/calendar-month.vue +5 -2
  23. package/components/calendar-popout/README.md +100 -0
  24. package/components/calendar-popout/calendar-popout.vue +35 -1
  25. package/components/card/README.md +82 -0
  26. package/components/card/card.vue +9 -0
  27. package/components/cascader/README.md +117 -0
  28. package/components/cascader/cascader.vue +13 -0
  29. package/components/cascader-input/README.md +51 -0
  30. package/components/cascader-input/cascader-input.vue +25 -0
  31. package/components/cascader-popout/README.md +53 -0
  32. package/components/cascader-popout/cascader-popout.vue +19 -0
  33. package/components/checkbox/README.md +185 -0
  34. package/components/checkbox/checkbox.vue +17 -0
  35. package/components/checkbox-group/checkbox-group.vue +15 -0
  36. package/components/checkbox-input/README.md +44 -0
  37. package/components/checkbox-input/checkbox-input.vue +22 -0
  38. package/components/checkbox-popout/README.md +52 -0
  39. package/components/checkbox-popout/checkbox-popout.vue +19 -0
  40. package/components/col/col.vue +7 -0
  41. package/components/collapse/README.md +45 -0
  42. package/components/collapse/collapse.vue +3 -0
  43. package/components/config/index.d.ts +2 -0
  44. package/components/config/index.js +1 -0
  45. package/components/count-down/README.md +97 -0
  46. package/components/count-down/count-down.vue +8 -0
  47. package/components/count-to/README.md +61 -0
  48. package/components/count-to/count-to.vue +7 -0
  49. package/components/crop-image/README.md +86 -0
  50. package/components/crop-image/crop-image.vue +15 -0
  51. package/components/datetime-picker/README.md +136 -0
  52. package/components/datetime-picker/datetime-picker.vue +14 -0
  53. package/components/datetime-picker-input/README.md +82 -0
  54. package/components/datetime-picker-input/datetime-picker-input.vue +25 -0
  55. package/components/datetime-picker-popout/README.md +77 -0
  56. package/components/datetime-picker-popout/datetime-picker-popout.vue +19 -0
  57. package/components/datetime-range-picker/README.md +49 -0
  58. package/components/datetime-range-picker/datetime-range-picker.vue +15 -0
  59. package/components/datetime-range-picker-input/README.md +58 -0
  60. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +26 -0
  61. package/components/datetime-range-picker-popout/README.md +53 -0
  62. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +20 -0
  63. package/components/dialog/README.md +192 -0
  64. package/components/dialog/dialog.vue +33 -0
  65. package/components/dialog-agent/dialog-agent.vue +21 -0
  66. package/components/divider/README.md +80 -0
  67. package/components/divider/divider.vue +8 -0
  68. package/components/dropdown/README.md +168 -0
  69. package/components/dropdown/common.d.ts +7 -0
  70. package/components/dropdown/common.js +1 -0
  71. package/components/dropdown/dropdown.vue +16 -1
  72. package/components/dropdown-item/dropdown-item.vue +51 -4
  73. package/components/empty/README.md +71 -0
  74. package/components/empty/empty.vue +8 -0
  75. package/components/fab/README.md +111 -0
  76. package/components/fab/fab.vue +18 -0
  77. package/components/floating-bubble/README.md +70 -0
  78. package/components/floating-bubble/floating-bubble.vue +11 -0
  79. package/components/floating-panel/README.md +78 -0
  80. package/components/floating-panel/floating-panel.vue +11 -0
  81. package/components/form/README.md +308 -0
  82. package/components/form/form.vue +19 -0
  83. package/components/form-item/form-item.vue +17 -0
  84. package/components/grid/README.md +140 -0
  85. package/components/grid/grid.vue +11 -0
  86. package/components/grid-item/grid-item.vue +15 -0
  87. package/components/icon/README.md +118 -0
  88. package/components/icon/common.d.ts +2 -0
  89. package/components/icon/icon.d.ts +1 -0
  90. package/components/icon/icon.vue +18 -3
  91. package/components/indexes/README.md +83 -0
  92. package/components/indexes/indexes.vue +7 -0
  93. package/components/indexes-anchor/indexes-anchor.vue +5 -0
  94. package/components/input/README.md +170 -0
  95. package/components/input/input.vue +55 -0
  96. package/components/keyboard/README.md +82 -0
  97. package/components/keyboard/keyboard.vue +7 -0
  98. package/components/layout/README.md +89 -0
  99. package/components/list/README.md +118 -0
  100. package/components/list/list.vue +8 -0
  101. package/components/list-item/list-item.vue +15 -0
  102. package/components/load-more/README.md +75 -0
  103. package/components/load-more/load-more.vue +11 -0
  104. package/components/loading/README.md +89 -0
  105. package/components/loading/loading.vue +13 -0
  106. package/components/lucky-draw/README.md +174 -0
  107. package/components/marquee/README.md +65 -0
  108. package/components/marquee/marquee.vue +7 -0
  109. package/components/menu/_README.md +61 -0
  110. package/components/navbar/README.md +123 -0
  111. package/components/navbar/navbar.vue +11 -0
  112. package/components/navbar-item/navbar-item.vue +10 -0
  113. package/components/notice-bar/README.md +135 -0
  114. package/components/notice-bar/notice-bar.vue +17 -0
  115. package/components/notify/README.md +118 -0
  116. package/components/notify/notify.vue +11 -0
  117. package/components/notify-agent/notify-agent.vue +12 -0
  118. package/components/overlay/README.md +56 -0
  119. package/components/overlay/overlay.vue +10 -0
  120. package/components/pagination/README.md +80 -0
  121. package/components/pagination/pagination.vue +15 -0
  122. package/components/password-input/README.md +87 -0
  123. package/components/password-input/password-input.vue +17 -0
  124. package/components/picker/README.md +115 -0
  125. package/components/picker/picker.vue +10 -0
  126. package/components/picker-input/README.md +51 -0
  127. package/components/picker-input/picker-input.vue +21 -0
  128. package/components/picker-popout/README.md +51 -0
  129. package/components/picker-popout/picker-popout.vue +15 -0
  130. package/components/popout/README.md +111 -0
  131. package/components/popout/popout.vue +29 -0
  132. package/components/popout-input/README.md +55 -0
  133. package/components/popout-input/popout-input.vue +15 -0
  134. package/components/popover/README.md +191 -0
  135. package/components/popover/popover.vue +15 -0
  136. package/components/popover-reference/popover-reference.vue +5 -0
  137. package/components/popup/README.md +67 -0
  138. package/components/popup/popup.vue +20 -0
  139. package/components/progress-bar/README.md +90 -0
  140. package/components/progress-bar/progress-bar.vue +13 -0
  141. package/components/progress-circle/README.md +75 -0
  142. package/components/progress-circle/progress-circle.vue +10 -0
  143. package/components/pull-down-refresh/README.md +100 -0
  144. package/components/pull-down-refresh/pull-down-refresh.vue +11 -0
  145. package/components/qrcode/README.md +103 -0
  146. package/components/qrcode/qrcode.vue +13 -0
  147. package/components/radio/README.md +172 -0
  148. package/components/radio/radio.vue +13 -0
  149. package/components/radio-group/radio-group.vue +16 -0
  150. package/components/radio-input/README.md +44 -0
  151. package/components/radio-input/radio-input.vue +23 -0
  152. package/components/radio-popout/README.md +52 -0
  153. package/components/radio-popout/radio-popout.vue +20 -0
  154. package/components/rate/README.md +106 -0
  155. package/components/rate/rate.vue +22 -0
  156. package/components/result/README.md +66 -0
  157. package/components/result/result.vue +10 -0
  158. package/components/row/row.vue +7 -0
  159. package/components/scroll-spy/README.md +70 -0
  160. package/components/scroll-spy/scroll-spy.vue +13 -0
  161. package/components/search/README.md +117 -0
  162. package/components/search/search.vue +25 -0
  163. package/components/share-sheet/README.md +94 -0
  164. package/components/share-sheet/share-sheet.vue +20 -0
  165. package/components/sidebar/README.md +118 -0
  166. package/components/sidebar/sidebar.vue +10 -0
  167. package/components/sidebar-item/sidebar-item.vue +8 -0
  168. package/components/signature/README.md +99 -0
  169. package/components/signature/signature.vue +20 -0
  170. package/components/skeleton/README.md +128 -0
  171. package/components/skeleton/skeleton.vue +12 -0
  172. package/components/skeleton-avatar/skeleton-avatar.vue +9 -0
  173. package/components/skeleton-block/skeleton-block.vue +8 -0
  174. package/components/skeleton-paragraph/skeleton-paragraph.vue +9 -0
  175. package/components/skeleton-title/skeleton-title.vue +8 -0
  176. package/components/slider/README.md +140 -0
  177. package/components/slider/slider.vue +29 -0
  178. package/components/space/README.md +82 -0
  179. package/components/space/space.vue +9 -0
  180. package/components/status-bar/README.md +72 -0
  181. package/components/status-bar/status-bar.vue +6 -0
  182. package/components/step/step.vue +9 -1
  183. package/components/stepper/README.md +94 -0
  184. package/components/stepper/stepper.vue +24 -0
  185. package/components/steps/README.md +142 -0
  186. package/components/steps/steps.vue +15 -0
  187. package/components/style/README.md +20 -0
  188. package/components/swipe-action/README.md +82 -0
  189. package/components/swipe-action/swipe-action.vue +7 -0
  190. package/components/swiper-dot/README.md +45 -0
  191. package/components/swiper-dot/swiper-dot.vue +9 -0
  192. package/components/switch/README.md +89 -0
  193. package/components/switch/switch.vue +18 -0
  194. package/components/tab/tab.vue +8 -0
  195. package/components/tabbar/README.md +111 -0
  196. package/components/tabbar/tabbar.vue +12 -0
  197. package/components/tabbar-item/tabbar-item.vue +12 -0
  198. package/components/tabbar-pit/README.md +41 -0
  199. package/components/tabbar-pit/tabbar-pit.vue +5 -0
  200. package/components/table/README.md +162 -0
  201. package/components/table/table.vue +7 -0
  202. package/components/table-cell/table-cell.vue +7 -0
  203. package/components/table-row/table-row.vue +5 -0
  204. package/components/tabs/README.md +113 -0
  205. package/components/tabs/tabs.vue +10 -0
  206. package/components/tag/README.md +96 -0
  207. package/components/tag/tag.vue +14 -0
  208. package/components/timeline/README.md +66 -0
  209. package/components/timeline/timeline.vue +4 -0
  210. package/components/timeline-item/timeline-item.vue +9 -0
  211. package/components/toast/README.md +111 -0
  212. package/components/toast/toast.vue +11 -0
  213. package/components/toast-agent/toast-agent.vue +11 -0
  214. package/components/tree/README.md +208 -0
  215. package/components/tree/tree.vue +21 -0
  216. package/components/upload/README.md +154 -0
  217. package/components/upload/upload.vue +22 -0
  218. package/package.json +74 -45
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [1.19.4](https://github.com/sutras/sard-uniapp/compare/v1.19.3...v1.19.4) (2025-06-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * calendar 允许修改范围文案 ([ba4debe](https://github.com/sutras/sard-uniapp/commit/ba4debefe74e8a7e9f9ea42141dd421ccc00a082))
7
+
8
+
9
+
10
+ ## [1.19.3](https://github.com/sutras/sard-uniapp/compare/v1.19.2...v1.19.3) (2025-06-17)
11
+
12
+
13
+ ### Features
14
+
15
+ * dropdown 新增 togglable 属性 ([e46291e](https://github.com/sutras/sard-uniapp/commit/e46291e99307ad977801153547b593ef97a56ee8))
16
+ * icon 添加 separate 属性 ([b20d069](https://github.com/sutras/sard-uniapp/commit/b20d0697ec4ef16fabf50e4bae3eab6908d6a572))
17
+
18
+
19
+
1
20
  ## [1.19.2](https://github.com/sutras/sard-uniapp/compare/v1.19.1...v1.19.2) (2025-06-14)
2
21
 
3
22
 
@@ -0,0 +1,91 @@
1
+ ---
2
+ nav: 组件
3
+ title: Accordion
4
+ subtitle: 手风琴
5
+ group:
6
+ title: 数据展示
7
+ order: 3
8
+ ---
9
+
10
+ ## 介绍
11
+
12
+ 通过折叠收纳内容,允许同时展开一个或多个。
13
+
14
+ ## 引入
15
+
16
+ ```ts
17
+ import Accordion from 'sard-uniapp/components/accordion/accordion.vue'
18
+ import AccordionItem from 'sard-uniapp/components/accordion-item/accordion-item.vue'
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础使用
24
+
25
+ 为手风琴每一个面板添加一个 `name` 属性,使用 `v-model` 绑定展开的面板。
26
+
27
+ @code('${DEMO_PATH}/accordion/demo/Basic.vue')
28
+
29
+ ### 展开多个
30
+
31
+ 设置 `multiple` 属性可以同时展开多个面板,此时 `v-model` 要绑定一个数组。
32
+
33
+ @code('${DEMO_PATH}/accordion/demo/Multiple.vue')
34
+
35
+ ### 禁用
36
+
37
+ 使用 `disabled` 属性可以禁用指定单个面板。
38
+
39
+ @code('${DEMO_PATH}/accordion/demo/Disabled.vue')
40
+
41
+ ## API
42
+
43
+ ### AccordionProps
44
+
45
+ | 属性 | 描述 | 类型 | 默认值 |
46
+ | ----------- | ---------------------- | ---------------------------------------- | ------ |
47
+ | root-class | 组件根元素类名 | string | - |
48
+ | root-style | 组件根元素样式 | StyleValue | - |
49
+ | model-value | 当前展开面板的 `name` | string \| number \| (string \| number)[] | - |
50
+ | multiple | 是否可同时展开多个面板 | boolean | false |
51
+
52
+ ### AccordionSlots
53
+
54
+ | 插槽 | 描述 | 属性 |
55
+ | ------- | -------------- | ---- |
56
+ | default | 自定义默认内容 | - |
57
+
58
+ ### AccordionEmits
59
+
60
+ | 事件 | 描述 | 类型 |
61
+ | ------------------ | -------------- | --------------------------------------------------------- |
62
+ | update:model-value | 切换面板时触发 | (value: string \| number \| (string \| number)[]) => void |
63
+
64
+ ### AccordionItemProps
65
+
66
+ | 属性 | 描述 | 类型 | 默认值 |
67
+ | ---------- | -------------- | ---------------- | ------ |
68
+ | root-class | 组件根元素类名 | string | - |
69
+ | root-style | 组件根元素样式 | StyleValue | - |
70
+ | title | 面板标题 | string | - |
71
+ | value | 面板的值 | string | - |
72
+ | name | 面板的唯一标识 | string \| number | - |
73
+ | disabled | 禁用面板 | boolean | false |
74
+
75
+ ### AccordionItemSlots
76
+
77
+ | 插槽 | 描述 | 属性 |
78
+ | ------- | -------------- | ---- |
79
+ | default | 自定义默认内容 | - |
80
+
81
+ ### AccordionItemEmits
82
+
83
+ | 事件 | 描述 | 类型 |
84
+ | ----- | ------------------ | -------------------- |
85
+ | click | 点击面板头部时触发 | (event: any) => void |
86
+
87
+ ## 主题定制
88
+
89
+ ### CSS 变量
90
+
91
+ @code('./variables.scss#variables')
@@ -11,6 +11,13 @@ import { classNames, stringifyStyle, createBem } from "../../utils";
11
11
  import {
12
12
  accoridonContextSymbol
13
13
  } from "./common";
14
+ /**
15
+ * @property {string} rootClass 组件根元素类名,默认值:-。
16
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
17
+ * @property {string | number | (string | number)[]} modelValue 当前展开面板的 `name`,默认值:-。
18
+ * @property {boolean} multiple 是否可同时展开多个面板,默认值:false。
19
+ * @event {(value: string | number | (string | number)[]) => void} update 切换面板时触发
20
+ */
14
21
  export default _defineComponent({
15
22
  ...{
16
23
  options: {
@@ -24,6 +24,15 @@ import {
24
24
  } from "../accordion/common";
25
25
  import SarCollapse from "../collapse/collapse.vue";
26
26
  import SarIcon from "../icon/icon.vue";
27
+ /**
28
+ * @property {string} rootClass 组件根元素类名,默认值:-。
29
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
30
+ * @property {string} title 面板标题,默认值:-。
31
+ * @property {string} value 面板的值,默认值:-。
32
+ * @property {string | number} name 面板的唯一标识,默认值:-。
33
+ * @property {boolean} disabled 禁用面板,默认值:false。
34
+ * @event {(event: any) => void} click 点击面板头部时触发
35
+ */
27
36
  export default _defineComponent({
28
37
  components: {
29
38
  SarCollapse,
@@ -0,0 +1,85 @@
1
+ ---
2
+ nav: 组件
3
+ title: ActionSheet
4
+ subtitle: 动作面板
5
+ group:
6
+ title: 反馈组件
7
+ order: 5
8
+ ---
9
+
10
+ ## 介绍
11
+
12
+ 从底部向上弹出动作菜单。
13
+
14
+ ## 引入
15
+
16
+ ```ts
17
+ import ActionSheet from 'sard-uniapp/components/action-sheet/action-sheet.vue'
18
+ ```
19
+
20
+ ## 代码演示
21
+
22
+ ### 基础使用
23
+
24
+ 使用 `v-model:visible` 属性控制显隐,使用 `itemList` 属性配置动作项。
25
+
26
+ @code('${DEMO_PATH}/action-sheet/demo/Basic.vue')
27
+
28
+ ### 取消按钮
29
+
30
+ 使用 `cancel` 属性展示取消按钮。
31
+
32
+ @code('${DEMO_PATH}/action-sheet/demo/Cancel.vue')
33
+
34
+ ### 描述信息
35
+
36
+ 使用 `description` 属性对整个动作面板做一个解释说明。使用动作项的 `description` 属性对某个动作做一个解释说明。
37
+
38
+ @code('${DEMO_PATH}/action-sheet/demo/Description.vue')
39
+
40
+ ### 动作状态
41
+
42
+ 每个动作项都可以配置 `color`、`disabled`、`loading` 等属性来展示当前的状态。
43
+
44
+ @code('${DEMO_PATH}/action-sheet/demo/Status.vue')
45
+
46
+ ## API
47
+
48
+ ### ActionSheetProps
49
+
50
+ | 属性 | 描述 | 类型 | 默认值 |
51
+ | ---------------- | -------------------------------------------------------------------- | ---------------------------------------------- | ------ |
52
+ | root-class | 组件根元素类名 | string | - |
53
+ | root-style | 组件根元素样式 | StyleValue | - |
54
+ | description | 动作面板描述说明 | string | - |
55
+ | item-list | 面板项列表 | ActionSheetItem[] | [] |
56
+ | cancel | 取消按钮文字 | string | - |
57
+ | visible | 是否显示动作面板 | boolean | false |
58
+ | overlay-closable | 点击遮罩后是否关闭 | boolean | true |
59
+ | before-close | 关闭前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭 | (type: 'close' \| 'cancel' \| 'select') => any | - |
60
+ | duration | 显隐动画时长,单位 ms | number | 300 |
61
+
62
+ ### ActionSheetItem
63
+
64
+ | 属性 | 描述 | 类型 | 默认值 |
65
+ | ----------- | -------------- | ------- | ------ |
66
+ | name | 动作名称 | string | - |
67
+ | description | 动作的描述说明 | string | - |
68
+ | color | 字体颜色 | string | - |
69
+ | disabled | 禁用状态 | boolean | false |
70
+ | loading | 加载状态 | boolean | false |
71
+
72
+ ### ActionSheetEmits
73
+
74
+ | 事件 | 描述 | 类型 |
75
+ | -------------- | ------------------ | ---------------------------------------------- |
76
+ | update:visible | 动作面板显隐时触发 | (visible: boolean) => void |
77
+ | close | 点击遮罩时触发 | () => void |
78
+ | cancel | 点击取消按钮时触发 | () => void |
79
+ | select | 点击动作按钮时触发 | (item: ActionSheetItem, index: number) => void |
80
+
81
+ ## 主题定制
82
+
83
+ ### CSS 变量
84
+
85
+ @code('./variables.scss#variables')
@@ -62,6 +62,21 @@ import SarLoading from "../loading/loading.vue";
62
62
  import {
63
63
  defaultActionSheetProps
64
64
  } from "./common";
65
+ /**
66
+ * @property {string} rootClass 组件根元素类名,默认值:-。
67
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
68
+ * @property {string} description 动作面板描述说明,默认值:-。
69
+ * @property {ActionSheetItem[]} itemList 面板项列表,默认值:[]。
70
+ * @property {string} cancel 取消按钮文字,默认值:-。
71
+ * @property {boolean} visible 是否显示动作面板,默认值:false。
72
+ * @property {boolean} overlayClosable 点击遮罩后是否关闭,默认值:true。
73
+ * @property {(type: 'close' | 'cancel' | 'select') => any} beforeClose 关闭前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭,默认值:-。
74
+ * @property {number} duration 显隐动画时长,单位 ms,默认值:300。
75
+ * @event {(visible: boolean) => void} update 动作面板显隐时触发
76
+ * @event {() => void} close 点击遮罩时触发
77
+ * @event {() => void} cancel 点击取消按钮时触发
78
+ * @event {(item: ActionSheetItem, index: number) => void} select 点击动作按钮时触发
79
+ */
65
80
  export default _defineComponent({
66
81
  components: {
67
82
  SarPopup,
@@ -0,0 +1,74 @@
1
+ ---
2
+ nav: 组件
3
+ title: Alert
4
+ subtitle: 警告提示
5
+ group: 反馈组件
6
+ version: 1.3+
7
+ ---
8
+
9
+ ## 介绍
10
+
11
+ 突出显示要重点提示用户的信息。警告提示会一直显示,除非用户手动关闭。
12
+
13
+ ## 引入
14
+
15
+ ```ts
16
+ import Alert from 'sard-uniapp/components/alert/alert.vue'
17
+ ```
18
+
19
+ ## 代码演示
20
+
21
+ ### 基础使用
22
+
23
+ @code('${DEMO_PATH}/alert/demo/Basic.vue')
24
+
25
+ ### 类型
26
+
27
+ 使用 `type` 属性设置不同的类型。
28
+
29
+ @code('${DEMO_PATH}/alert/demo/Type.vue')
30
+
31
+ ### 显示图标
32
+
33
+ 设置 `show-icon` 属性显示图标。
34
+
35
+ @code('${DEMO_PATH}/alert/demo/ShowIcon.vue')
36
+
37
+ ### 可关闭的
38
+
39
+ 设置 `closable` 属性显示关闭按钮。
40
+
41
+ @code('${DEMO_PATH}/alert/demo/Closable.vue')
42
+
43
+ ## API
44
+
45
+ ### AlertProps
46
+
47
+ | 属性 | 描述 | 类型 | 默认值 |
48
+ | ---------- | ---------------- | ----------------------------------------------- | --------- |
49
+ | root-class | 组件根元素类名 | string | - |
50
+ | root-style | 组件根元素样式 | StyleValue | - |
51
+ | type | 警告提示样式类型 | 'primary' \| 'success' \| 'warning' \| 'danger' | 'primary' |
52
+ | show-icon | 是否显示图标 | StyleValue | - |
53
+ | closable | 是否显示关闭按钮 | boolean | false |
54
+ | color | 字体颜色 | string | - |
55
+ | background | 背景颜色 | string | - |
56
+
57
+ ### AlertSlots
58
+
59
+ | 插槽 | 描述 | 属性 |
60
+ | ------- | -------------- | ---- |
61
+ | default | 自定义默认内容 | - |
62
+ | icon | 自定义图标 | - |
63
+
64
+ ### AlertEmits
65
+
66
+ | 事件 | 描述 | 类型 |
67
+ | ----- | ---------------- | ---------- |
68
+ | close | 点击关闭按钮触发 | () => void |
69
+
70
+ ## 主题定制
71
+
72
+ ### CSS 变量
73
+
74
+ @code('./variables.scss#variables')
@@ -21,6 +21,16 @@ import {
21
21
  mapTypeIcon
22
22
  } from "./common";
23
23
  import SarIcon from "../icon/icon.vue";
24
+ /**
25
+ * @property {string} rootClass 组件根元素类名,默认值:-。
26
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
27
+ * @property {'primary' | 'success' | 'warning' | 'danger'} type 警告提示样式类型,默认值:'primary'。
28
+ * @property {StyleValue} showIcon 是否显示图标,默认值:-。
29
+ * @property {boolean} closable 是否显示关闭按钮,默认值:false。
30
+ * @property {string} color 字体颜色,默认值:-。
31
+ * @property {string} background 背景颜色,默认值:-。
32
+ * @event {() => void} close 点击关闭按钮触发
33
+ */
24
34
  export default _defineComponent({
25
35
  components: {
26
36
  SarIcon,
@@ -0,0 +1,86 @@
1
+ ---
2
+ nav: 组件
3
+ title: Avatar
4
+ subtitle: 头像
5
+ group: 数据展示
6
+ ---
7
+
8
+ ## 介绍
9
+
10
+ 用图片、图标或字符等来展示头像、群、库等事物信息。
11
+
12
+ ## 引入
13
+
14
+ ```ts
15
+ import Avatar from 'sard-uniapp/components/avatar/avatar.vue'
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ### 基础使用
21
+
22
+ 默认展示一个人头图标。
23
+
24
+ @code('${DEMO_PATH}/avatar/demo/Basic.vue')
25
+
26
+ ### 形状
27
+
28
+ 设置 `shape="square" ` 将其改为带圆角的方形。
29
+
30
+ @code('${DEMO_PATH}/avatar/demo/Shape.vue')
31
+
32
+ ### 尺寸
33
+
34
+ `size` 设置头像大小,`iconSize` 设置图标大小。
35
+
36
+ @code('${DEMO_PATH}/avatar/demo/Size.vue')
37
+
38
+ ### 自定义样式
39
+
40
+ `background` 设置头像背景色,`color` 设置图标颜色。
41
+
42
+ @code('${DEMO_PATH}/avatar/demo/Style.vue')
43
+
44
+ ### 图片类型
45
+
46
+ 设置 `src` 图片路径将展示一个完全覆盖框框的图片。
47
+
48
+ @code('${DEMO_PATH}/avatar/demo/Picture.vue')
49
+
50
+ ### 自定义内容
51
+
52
+ 默认插槽配置的内容会代替默认的内容。
53
+
54
+ @code('${DEMO_PATH}/avatar/demo/Children.vue')
55
+
56
+ ### 额外内容
57
+
58
+ `extra` 属性可以展示例如徽标等组件。要使徽标固定在圆角形状头像右上角边上可以使用 `14.6447%` 的固定值。
59
+
60
+ @code('${DEMO_PATH}/avatar/demo/Extra.vue')
61
+
62
+ ## API
63
+
64
+ ### AvatarProps
65
+
66
+ | 属性 | 描述 | 类型 | 默认值 |
67
+ | ---------- | ---------------------- | -------------------- | -------- |
68
+ | root-class | 组件根元素类名 | string | - |
69
+ | root-style | 组件根元素样式 | StyleValue | - |
70
+ | shape | 头像形状 | 'circle' \| 'square' | 'circle' |
71
+ | size | 头像尺寸 | string | - |
72
+ | icon-size | 图标尺寸 | string | - |
73
+ | src | 图片类型头像的图片地址 | string | - |
74
+
75
+ ### AvatarSlots
76
+
77
+ | 插槽 | 描述 | 属性 |
78
+ | ------- | ------------------------ | ---- |
79
+ | default | 自定义默认内容 | - |
80
+ | extra | 额外内容,常用于展示徽标 | - |
81
+
82
+ ## 主题定制
83
+
84
+ ### CSS 变量
85
+
86
+ @code('./variables.scss#variables')
@@ -27,6 +27,14 @@ import SarIcon from "../icon/icon.vue";
27
27
  import {
28
28
  defaultAvatarProps
29
29
  } from "./common";
30
+ /**
31
+ * @property {string} rootClass 组件根元素类名,默认值:-。
32
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
33
+ * @property {'circle' | 'square'} shape 头像形状,默认值:'circle'。
34
+ * @property {string} size 头像尺寸,默认值:-。
35
+ * @property {string} iconSize 图标尺寸,默认值:-。
36
+ * @property {string} src 图片类型头像的图片地址,默认值:-。
37
+ */
30
38
  export default _defineComponent({
31
39
  components: {
32
40
  SarIcon,
@@ -0,0 +1,134 @@
1
+ ---
2
+ nav: 组件
3
+ title: BackTop
4
+ subtitle: 回到顶部
5
+ group:
6
+ title: 导航组件
7
+ order: 4
8
+ version: 1.6+
9
+ ---
10
+
11
+ ## 介绍
12
+
13
+ 返回页面顶部的操作按钮。
14
+
15
+ ## 引入
16
+
17
+ ```ts
18
+ import BackTop from 'sard-uniapp/components/back-top/back-top.vue'
19
+ ```
20
+
21
+ ## 代码演示
22
+
23
+ ### 基础使用
24
+
25
+ 返回页面顶部时,`BackTop` 组件需要配合 `usePageBackTop` 组合式函数使用。
26
+
27
+ `BackTop` 组件需要绑定 `usePageBackTop` 返回的 `scrollTop` 属性值和 `onClick` 回调。
28
+
29
+ 另外,为了让 `uniapp` 编译器能够初始化 `onPageScroll` 页面钩子,需要显式在页面组件调用 `onPageScroll` 组合式函数。
30
+
31
+ @code('${DEMO_PATH}/back-top/demo/Basic.vue')
32
+
33
+ ### scroll-view 组件滚动
34
+
35
+ 返回 `scroll-view` 顶部时,`BackTop` 组件需要配合 `useScrollViewBackTop` 组合式函数使用。
36
+
37
+ `BackTop` 组件需要绑定 `useScrollViewBackTop` 返回的 `scrollTop` 属性值和 `onClick` 回调。
38
+
39
+ `scroll-view` 组件需要绑定 `useScrollViewBackTop` 返回的 `scrollTop` 属性值和 `onScroll` 回调。
40
+
41
+ @code('${DEMO_PATH}/back-top/demo/ScrollView.vue')
42
+
43
+ ### 按钮位置
44
+
45
+ 通过设置 `right` 和 `bottom` 属性可以自定义按钮距离右下角的距离。
46
+
47
+ @code('${DEMO_PATH}/back-top/demo/Position.vue')
48
+
49
+ ### 滚动时长
50
+
51
+ `usePageBackTop` 组合式函数可以接收一个数值类型参数,表示滚动到页面顶部的动画时长。
52
+
53
+ `scroll-view` 默认没有滚动动画,通过设置 `scroll-with-animation` 属性可以添加滚动动画。
54
+
55
+ @code('${DEMO_PATH}/back-top/demo/Duration.vue')
56
+
57
+ ### 可见时的高度
58
+
59
+ 默认情况下,当页面或 `scroll-view` 滚动到一定距离时,按钮才会显示。
60
+
61
+ 可以设置 `visible-height` 为 0 让按钮一直显示。
62
+
63
+ @code('${DEMO_PATH}/back-top/demo/VisibleHeight.vue')
64
+
65
+ ### 自定义按钮内容
66
+
67
+ 使用默认插槽自定义组件展示的内容。
68
+
69
+ @code('${DEMO_PATH}/back-top/demo/CustomContent.vue')
70
+
71
+ ## API
72
+
73
+ ### BackTopProps
74
+
75
+ | 属性 | 描述 | 类型 | 默认值 |
76
+ | -------------- | ----------------------------------------------------- | ---------- | ------ |
77
+ | root-class | 组件根元素类名 | string | - |
78
+ | root-style | 组件根元素样式 | StyleValue | - |
79
+ | scroll-top | 当前页面或 scroll-view 滚动的高度 | number | 0 |
80
+ | visible-height | 回到顶部按钮显示时的页面或 scroll-view 滚动的最小高度 | number | 200 |
81
+ | right | 回到顶部按钮距离右边的距离 | string | - |
82
+ | bottom | 回到顶部按钮距离底部的距离 | string | - |
83
+
84
+ ### BackTopSlots
85
+
86
+ | 插槽 | 描述 | 属性 |
87
+ | ------- | -------------- | ---- |
88
+ | default | 自定义默认内容 | - |
89
+
90
+ ### BackTopEmits
91
+
92
+ | 事件 | 描述 | 类型 |
93
+ | ----- | ---------- | -------------------- |
94
+ | click | 点击时触发 | (event: any) => void |
95
+
96
+ ### usePageBackTop
97
+
98
+ ```ts
99
+ function usePageBackTop(duration?: number): {
100
+ scrollTop: Ref<number>
101
+ onClick: () => void
102
+ }
103
+ ```
104
+
105
+ | 参数 | 描述 | 类型 | 默认值 |
106
+ | -------- | --------------------- | ------ | ------ |
107
+ | duration | 滚动动画时长,单位 ms | number | 300 |
108
+
109
+ | 返回对象的属性 | 描述 | 类型 |
110
+ | -------------- | ----------------------------------------------- | ------------ |
111
+ | scrollTop | 需要绑定到 `BackTop` 组件 `scroll-top` 属性的值 | Ref\<number> |
112
+ | onClick | 需要绑定到 `BackTop` 组件 `click` 事件的回调 | () => void |
113
+
114
+ ### useScrollViewBackTop
115
+
116
+ ```ts
117
+ function useScrollViewBackTop(): {
118
+ scrollTop: Ref<number>
119
+ onScroll: (event: any) => void
120
+ onClick: () => void
121
+ }
122
+ ```
123
+
124
+ | 返回对象的属性 | 描述 | 类型 |
125
+ | -------------- | --------------------------------------------------------------- | -------------------- |
126
+ | scrollTop | 需要绑定到 `BackTop` 和 `ScrollView` 组件 `scroll-top` 属性的值 | Ref\<number> |
127
+ | onScroll | 需要绑定到 `ScrollView` 组件 `scroll` 事件的回调 | (event: any) => void |
128
+ | onClick | 需要绑定到 `BackTop` 组件 `click` 事件的回调 | () => void |
129
+
130
+ ## 主题定制
131
+
132
+ ### CSS 变量
133
+
134
+ @code('./variables.scss#variables')
@@ -14,6 +14,15 @@ import {
14
14
  defaultBackTopProps
15
15
  } from "./common";
16
16
  import SarIcon from "../icon/icon.vue";
17
+ /**
18
+ * @property {string} rootClass 组件根元素类名,默认值:-。
19
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
20
+ * @property {number} scrollTop 当前页面或 scroll-view 滚动的高度,默认值:0。
21
+ * @property {number} visibleHeight 回到顶部按钮显示时的页面或 scroll-view 滚动的最小高度,默认值:200。
22
+ * @property {string} right 回到顶部按钮距离右边的距离,默认值:-。
23
+ * @property {string} bottom 回到顶部按钮距离底部的距离,默认值:-。
24
+ * @event {(event: any) => void} click 点击时触发
25
+ */
17
26
  export default _defineComponent({
18
27
  components: {
19
28
  SarIcon,