stellar-ui-plus 1.16.18

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 (382) hide show
  1. package/README.md +176 -0
  2. package/common/css/common.scss +19 -0
  3. package/common/useProps.js +9 -0
  4. package/components/ste-animate/ATTRIBUTES.md +10 -0
  5. package/components/ste-animate/README.md +115 -0
  6. package/components/ste-animate/animate.scss +247 -0
  7. package/components/ste-animate/config.json +5 -0
  8. package/components/ste-animate/props.ts +9 -0
  9. package/components/ste-animate/ste-animate.easycom.json +39 -0
  10. package/components/ste-animate/ste-animate.scss +113 -0
  11. package/components/ste-animate/ste-animate.vue +67 -0
  12. package/components/ste-badge/ATTRIBUTES.md +17 -0
  13. package/components/ste-badge/README.md +162 -0
  14. package/components/ste-badge/config.json +5 -0
  15. package/components/ste-badge/props.ts +17 -0
  16. package/components/ste-badge/ste-badge.easycom.json +96 -0
  17. package/components/ste-badge/ste-badge.vue +157 -0
  18. package/components/ste-barcode/ATTRIBUTES.md +14 -0
  19. package/components/ste-barcode/README.md +28 -0
  20. package/components/ste-barcode/config.json +5 -0
  21. package/components/ste-barcode/encode.ts +317 -0
  22. package/components/ste-barcode/props.ts +7 -0
  23. package/components/ste-barcode/ste-barcode.easycom.json +44 -0
  24. package/components/ste-barcode/ste-barcode.vue +152 -0
  25. package/components/ste-button/ATTRIBUTES.md +32 -0
  26. package/components/ste-button/README.md +119 -0
  27. package/components/ste-button/config.json +5 -0
  28. package/components/ste-button/props.ts +21 -0
  29. package/components/ste-button/ste-button.easycom.json +168 -0
  30. package/components/ste-button/ste-button.vue +275 -0
  31. package/components/ste-calendar/ATTRIBUTES.md +31 -0
  32. package/components/ste-calendar/README.md +241 -0
  33. package/components/ste-calendar/config.json +5 -0
  34. package/components/ste-calendar/date.ts +110 -0
  35. package/components/ste-calendar/props.ts +26 -0
  36. package/components/ste-calendar/ste-calendar.easycom.json +172 -0
  37. package/components/ste-calendar/ste-calendar.vue +376 -0
  38. package/components/ste-calendar/useData.ts +30 -0
  39. package/components/ste-checkbox/ATTRIBUTES.md +25 -0
  40. package/components/ste-checkbox/README.md +302 -0
  41. package/components/ste-checkbox/config.json +5 -0
  42. package/components/ste-checkbox/props.ts +33 -0
  43. package/components/ste-checkbox/ste-checkbox.easycom.json +151 -0
  44. package/components/ste-checkbox/ste-checkbox.vue +206 -0
  45. package/components/ste-checkbox/type.d.ts +2 -0
  46. package/components/ste-checkbox-group/props.ts +34 -0
  47. package/components/ste-checkbox-group/ste-checkbox-group.vue +34 -0
  48. package/components/ste-code-input/ATTRIBUTES.md +22 -0
  49. package/components/ste-code-input/README.md +56 -0
  50. package/components/ste-code-input/config.json +5 -0
  51. package/components/ste-code-input/props.ts +19 -0
  52. package/components/ste-code-input/ste-code-input.easycom.json +99 -0
  53. package/components/ste-code-input/ste-code-input.vue +222 -0
  54. package/components/ste-date-picker/ATTRIBUTES.md +25 -0
  55. package/components/ste-date-picker/README.md +119 -0
  56. package/components/ste-date-picker/config.json +5 -0
  57. package/components/ste-date-picker/props.ts +62 -0
  58. package/components/ste-date-picker/ste-date-picker.easycom.json +137 -0
  59. package/components/ste-date-picker/ste-date-picker.vue +290 -0
  60. package/components/ste-date-picker/types.d.ts +3 -0
  61. package/components/ste-drag/ATTRIBUTES.md +13 -0
  62. package/components/ste-drag/README.md +88 -0
  63. package/components/ste-drag/config.json +5 -0
  64. package/components/ste-drag/props.ts +10 -0
  65. package/components/ste-drag/ste-drag.easycom.json +50 -0
  66. package/components/ste-drag/ste-drag.vue +172 -0
  67. package/components/ste-dropdown-menu/ATTRIBUTES.md +22 -0
  68. package/components/ste-dropdown-menu/README.md +325 -0
  69. package/components/ste-dropdown-menu/config.json +5 -0
  70. package/components/ste-dropdown-menu/constans.ts +4 -0
  71. package/components/ste-dropdown-menu/props.ts +30 -0
  72. package/components/ste-dropdown-menu/ste-dropdown-menu.easycom.json +111 -0
  73. package/components/ste-dropdown-menu/ste-dropdown-menu.scss +99 -0
  74. package/components/ste-dropdown-menu/ste-dropdown-menu.vue +223 -0
  75. package/components/ste-dropdown-menu-item/props.ts +17 -0
  76. package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.scss +61 -0
  77. package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +84 -0
  78. package/components/ste-dropdown-menu-item/type.d.ts +4 -0
  79. package/components/ste-icon/ATTRIBUTES.md +19 -0
  80. package/components/ste-icon/README.md +72 -0
  81. package/components/ste-icon/config.json +5 -0
  82. package/components/ste-icon/iconfont.css +22 -0
  83. package/components/ste-icon/props.ts +14 -0
  84. package/components/ste-icon/ste-icon.easycom.json +71 -0
  85. package/components/ste-icon/ste-icon.vue +80 -0
  86. package/components/ste-image/ATTRIBUTES.md +21 -0
  87. package/components/ste-image/README.md +118 -0
  88. package/components/ste-image/config.json +5 -0
  89. package/components/ste-image/props.ts +15 -0
  90. package/components/ste-image/ste-image.easycom.json +189 -0
  91. package/components/ste-image/ste-image.vue +146 -0
  92. package/components/ste-index-item/props.ts +4 -0
  93. package/components/ste-index-item/ste-index-item.vue +83 -0
  94. package/components/ste-index-list/ATTRIBUTES.md +15 -0
  95. package/components/ste-index-list/README.md +138 -0
  96. package/components/ste-index-list/config.json +5 -0
  97. package/components/ste-index-list/props.ts +17 -0
  98. package/components/ste-index-list/ste-index-list.easycom.json +48 -0
  99. package/components/ste-index-list/ste-index-list.vue +109 -0
  100. package/components/ste-input/ATTRIBUTES.md +37 -0
  101. package/components/ste-input/README.md +130 -0
  102. package/components/ste-input/config.json +5 -0
  103. package/components/ste-input/props.ts +46 -0
  104. package/components/ste-input/ste-input.easycom.json +282 -0
  105. package/components/ste-input/ste-input.scss +124 -0
  106. package/components/ste-input/ste-input.vue +221 -0
  107. package/components/ste-loading/ATTRIBUTES.md +11 -0
  108. package/components/ste-loading/README.md +74 -0
  109. package/components/ste-loading/config.json +5 -0
  110. package/components/ste-loading/props.ts +8 -0
  111. package/components/ste-loading/ste-loading.easycom.json +54 -0
  112. package/components/ste-loading/ste-loading.vue +127 -0
  113. package/components/ste-media-preview/ATTRIBUTES.md +20 -0
  114. package/components/ste-media-preview/README.md +252 -0
  115. package/components/ste-media-preview/TouchScaleing.ts +117 -0
  116. package/components/ste-media-preview/config.json +5 -0
  117. package/components/ste-media-preview/props.ts +12 -0
  118. package/components/ste-media-preview/ste-media-preview.easycom.json +88 -0
  119. package/components/ste-media-preview/ste-media-preview.vue +201 -0
  120. package/components/ste-media-preview/useData.ts +63 -0
  121. package/components/ste-message-box/ATTRIBUTES.md +6 -0
  122. package/components/ste-message-box/README.md +222 -0
  123. package/components/ste-message-box/config.json +5 -0
  124. package/components/ste-message-box/constants.ts +25 -0
  125. package/components/ste-message-box/ste-message-box.easycom.json +14 -0
  126. package/components/ste-message-box/ste-message-box.ts +1 -0
  127. package/components/ste-message-box/ste-message-box.vue +355 -0
  128. package/components/ste-message-box/use-message-box.ts +26 -0
  129. package/components/ste-message-box/useData.ts +56 -0
  130. package/components/ste-notice-bar/ATTRIBUTES.md +22 -0
  131. package/components/ste-notice-bar/README.md +124 -0
  132. package/components/ste-notice-bar/config.json +5 -0
  133. package/components/ste-notice-bar/props.ts +15 -0
  134. package/components/ste-notice-bar/ste-notice-bar.easycom.json +109 -0
  135. package/components/ste-notice-bar/ste-notice-bar.vue +262 -0
  136. package/components/ste-number-keyboard/ATTRIBUTES.md +31 -0
  137. package/components/ste-number-keyboard/KeyboardVue.vue +142 -0
  138. package/components/ste-number-keyboard/README.md +192 -0
  139. package/components/ste-number-keyboard/config.json +5 -0
  140. package/components/ste-number-keyboard/props.ts +35 -0
  141. package/components/ste-number-keyboard/ste-number-keyboard.easycom.json +177 -0
  142. package/components/ste-number-keyboard/ste-number-keyboard.vue +81 -0
  143. package/components/ste-number-keyboard/useData.ts +144 -0
  144. package/components/ste-picker/props.ts +16 -0
  145. package/components/ste-picker/ste-picker.vue +194 -0
  146. package/components/ste-popup/ATTRIBUTES.md +24 -0
  147. package/components/ste-popup/README.md +135 -0
  148. package/components/ste-popup/config.json +6 -0
  149. package/components/ste-popup/event.ts +0 -0
  150. package/components/ste-popup/props.ts +19 -0
  151. package/components/ste-popup/ste-popup.easycom.json +122 -0
  152. package/components/ste-popup/ste-popup.vue +253 -0
  153. package/components/ste-price/ATTRIBUTES.md +26 -0
  154. package/components/ste-price/README.md +110 -0
  155. package/components/ste-price/config.json +5 -0
  156. package/components/ste-price/props.ts +23 -0
  157. package/components/ste-price/ste-price.easycom.json +154 -0
  158. package/components/ste-price/ste-price.vue +148 -0
  159. package/components/ste-progress/ATTRIBUTES.md +17 -0
  160. package/components/ste-progress/README.md +88 -0
  161. package/components/ste-progress/config.json +5 -0
  162. package/components/ste-progress/props.ts +16 -0
  163. package/components/ste-progress/ste-progress.easycom.json +80 -0
  164. package/components/ste-progress/ste-progress.vue +135 -0
  165. package/components/ste-qrcode/ATTRIBUTES.md +16 -0
  166. package/components/ste-qrcode/README.md +34 -0
  167. package/components/ste-qrcode/config.json +5 -0
  168. package/components/ste-qrcode/props.ts +16 -0
  169. package/components/ste-qrcode/ste-qrcode.easycom.json +56 -0
  170. package/components/ste-qrcode/ste-qrcode.vue +134 -0
  171. package/components/ste-qrcode/uqrcode.d.ts +57 -0
  172. package/components/ste-qrcode/uqrcode.js +34 -0
  173. package/components/ste-radio/ATTRIBUTES.md +25 -0
  174. package/components/ste-radio/README.md +260 -0
  175. package/components/ste-radio/config.json +5 -0
  176. package/components/ste-radio/props.ts +33 -0
  177. package/components/ste-radio/ste-radio.easycom.json +150 -0
  178. package/components/ste-radio/ste-radio.vue +188 -0
  179. package/components/ste-radio/type.d.ts +2 -0
  180. package/components/ste-radio-group/props.ts +33 -0
  181. package/components/ste-radio-group/ste-radio-group.vue +34 -0
  182. package/components/ste-rate/ATTRIBUTES.md +21 -0
  183. package/components/ste-rate/README.md +97 -0
  184. package/components/ste-rate/config.json +5 -0
  185. package/components/ste-rate/props.ts +16 -0
  186. package/components/ste-rate/ste-rate.easycom.json +85 -0
  187. package/components/ste-rate/ste-rate.vue +143 -0
  188. package/components/ste-read-more/ATTRIBUTES.md +16 -0
  189. package/components/ste-read-more/README.md +93 -0
  190. package/components/ste-read-more/config.json +5 -0
  191. package/components/ste-read-more/props.ts +9 -0
  192. package/components/ste-read-more/ste-read-more.easycom.json +54 -0
  193. package/components/ste-read-more/ste-read-more.vue +106 -0
  194. package/components/ste-rich-text/ATTRIBUTES.md +8 -0
  195. package/components/ste-rich-text/README.md +26 -0
  196. package/components/ste-rich-text/config.json +5 -0
  197. package/components/ste-rich-text/props.ts +8 -0
  198. package/components/ste-rich-text/ste-rich-text.easycom.json +40 -0
  199. package/components/ste-rich-text/ste-rich-text.vue +33 -0
  200. package/components/ste-scroll-to/ATTRIBUTES.md +11 -0
  201. package/components/ste-scroll-to/README.md +47 -0
  202. package/components/ste-scroll-to/config.json +5 -0
  203. package/components/ste-scroll-to/props.ts +17 -0
  204. package/components/ste-scroll-to/ste-scroll-to.easycom.json +25 -0
  205. package/components/ste-scroll-to/ste-scroll-to.vue +42 -0
  206. package/components/ste-scroll-to/useData.ts +214 -0
  207. package/components/ste-scroll-to-item/ste-scroll-to-item.vue +24 -0
  208. package/components/ste-search/ATTRIBUTES.md +39 -0
  209. package/components/ste-search/README.md +232 -0
  210. package/components/ste-search/config.json +5 -0
  211. package/components/ste-search/props.ts +124 -0
  212. package/components/ste-search/ste-search.easycom.json +232 -0
  213. package/components/ste-search/ste-search.vue +379 -0
  214. package/components/ste-search/useData.ts +34 -0
  215. package/components/ste-select/ATTRIBUTES.md +39 -0
  216. package/components/ste-select/README.md +324 -0
  217. package/components/ste-select/config.json +5 -0
  218. package/components/ste-select/datapager.vue +54 -0
  219. package/components/ste-select/datetime.vue +109 -0
  220. package/components/ste-select/defaultDate.ts +138 -0
  221. package/components/ste-select/props.ts +67 -0
  222. package/components/ste-select/ste-select.easycom.json +287 -0
  223. package/components/ste-select/ste-select.vue +437 -0
  224. package/components/ste-select/useData.ts +471 -0
  225. package/components/ste-signature/ATTRIBUTES.md +18 -0
  226. package/components/ste-signature/README.md +97 -0
  227. package/components/ste-signature/config.json +5 -0
  228. package/components/ste-signature/props.ts +12 -0
  229. package/components/ste-signature/ste-signature.easycom.json +74 -0
  230. package/components/ste-signature/ste-signature.vue +183 -0
  231. package/components/ste-signature/types.d.ts +4 -0
  232. package/components/ste-slider/ATTRIBUTES.md +25 -0
  233. package/components/ste-slider/README.md +149 -0
  234. package/components/ste-slider/config.json +5 -0
  235. package/components/ste-slider/props.ts +32 -0
  236. package/components/ste-slider/ste-slider.easycom.json +128 -0
  237. package/components/ste-slider/ste-slider.scss +150 -0
  238. package/components/ste-slider/ste-slider.vue +293 -0
  239. package/components/ste-slider/type.d.ts +4 -0
  240. package/components/ste-slider/useData.ts +79 -0
  241. package/components/ste-step/props.ts +10 -0
  242. package/components/ste-step/ste-step.scss +104 -0
  243. package/components/ste-step/ste-step.vue +122 -0
  244. package/components/ste-stepper/ATTRIBUTES.md +33 -0
  245. package/components/ste-stepper/README.md +172 -0
  246. package/components/ste-stepper/config.json +5 -0
  247. package/components/ste-stepper/props.ts +41 -0
  248. package/components/ste-stepper/ste-stepper.easycom.json +220 -0
  249. package/components/ste-stepper/ste-stepper.vue +249 -0
  250. package/components/ste-steps/ATTRIBUTES.md +12 -0
  251. package/components/ste-steps/README.md +139 -0
  252. package/components/ste-steps/config.json +5 -0
  253. package/components/ste-steps/props.ts +18 -0
  254. package/components/ste-steps/ste-steps.easycom.json +46 -0
  255. package/components/ste-steps/ste-steps.vue +44 -0
  256. package/components/ste-sticky/ATTRIBUTES.md +15 -0
  257. package/components/ste-sticky/README.md +56 -0
  258. package/components/ste-sticky/config.json +5 -0
  259. package/components/ste-sticky/props.ts +7 -0
  260. package/components/ste-sticky/ste-sticky.easycom.json +48 -0
  261. package/components/ste-sticky/ste-sticky.vue +88 -0
  262. package/components/ste-swipe-action/ATTRIBUTES.md +16 -0
  263. package/components/ste-swipe-action/README.md +195 -0
  264. package/components/ste-swipe-action/config.json +5 -0
  265. package/components/ste-swipe-action/props.ts +23 -0
  266. package/components/ste-swipe-action/ste-swipe-action.easycom.json +74 -0
  267. package/components/ste-swipe-action/ste-swipe-action.vue +138 -0
  268. package/components/ste-swipe-action/useData.ts +204 -0
  269. package/components/ste-swipe-action-group/ATTRIBUTES.md +17 -0
  270. package/components/ste-swipe-action-group/props.ts +22 -0
  271. package/components/ste-swipe-action-group/ste-swipe-action-group.easycom.json +90 -0
  272. package/components/ste-swipe-action-group/ste-swipe-action-group.vue +57 -0
  273. package/components/ste-swiper/ATTRIBUTES.md +24 -0
  274. package/components/ste-swiper/README.md +156 -0
  275. package/components/ste-swiper/config.json +5 -0
  276. package/components/ste-swiper/props.ts +41 -0
  277. package/components/ste-swiper/ste-swiper.easycom.json +123 -0
  278. package/components/ste-swiper/ste-swiper.vue +98 -0
  279. package/components/ste-swiper/useData.ts +365 -0
  280. package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
  281. package/components/ste-switch/ATTRIBUTES.md +17 -0
  282. package/components/ste-switch/README.md +105 -0
  283. package/components/ste-switch/config.json +5 -0
  284. package/components/ste-switch/props.ts +9 -0
  285. package/components/ste-switch/ste-switch.easycom.json +60 -0
  286. package/components/ste-switch/ste-switch.vue +96 -0
  287. package/components/ste-tab/ATTRIBUTES.md +14 -0
  288. package/components/ste-tab/props.ts +25 -0
  289. package/components/ste-tab/ste-tab.easycom.json +56 -0
  290. package/components/ste-tab/ste-tab.vue +26 -0
  291. package/components/ste-table/ATTRIBUTES.md +41 -0
  292. package/components/ste-table/README.md +638 -0
  293. package/components/ste-table/config.json +5 -0
  294. package/components/ste-table/props.ts +72 -0
  295. package/components/ste-table/ste-table.easycom.json +188 -0
  296. package/components/ste-table/ste-table.vue +427 -0
  297. package/components/ste-table/types.d.ts +3 -0
  298. package/components/ste-table/useData.ts +233 -0
  299. package/components/ste-table/utils.ts +11 -0
  300. package/components/ste-table-column/checkbox-icon.vue +35 -0
  301. package/components/ste-table-column/common.scss +52 -0
  302. package/components/ste-table-column/props.ts +18 -0
  303. package/components/ste-table-column/radio-icon.vue +99 -0
  304. package/components/ste-table-column/ste-table-column.vue +169 -0
  305. package/components/ste-table-column/var.scss +1 -0
  306. package/components/ste-tabs/ATTRIBUTES.md +52 -0
  307. package/components/ste-tabs/README.md +165 -0
  308. package/components/ste-tabs/config.json +5 -0
  309. package/components/ste-tabs/props.ts +133 -0
  310. package/components/ste-tabs/ste-tabs.easycom.json +278 -0
  311. package/components/ste-tabs/ste-tabs.vue +447 -0
  312. package/components/ste-tabs/useData.ts +364 -0
  313. package/components/ste-text/ATTRIBUTES.md +9 -0
  314. package/components/ste-text/README.md +58 -0
  315. package/components/ste-text/config.json +6 -0
  316. package/components/ste-text/props.ts +10 -0
  317. package/components/ste-text/ste-text.easycom.json +30 -0
  318. package/components/ste-text/ste-text.vue +46 -0
  319. package/components/ste-toast/ATTRIBUTES.md +15 -0
  320. package/components/ste-toast/README.md +222 -0
  321. package/components/ste-toast/config.json +5 -0
  322. package/components/ste-toast/props.ts +7 -0
  323. package/components/ste-toast/ste-toast.easycom.json +73 -0
  324. package/components/ste-toast/ste-toast.vue +209 -0
  325. package/components/ste-toast/use-toast.ts +26 -0
  326. package/components/ste-touch-swipe/ATTRIBUTES.md +18 -0
  327. package/components/ste-touch-swipe/README.md +89 -0
  328. package/components/ste-touch-swipe/TouchEvent.ts +79 -0
  329. package/components/ste-touch-swipe/config.json +5 -0
  330. package/components/ste-touch-swipe/props.ts +23 -0
  331. package/components/ste-touch-swipe/ste-touch-swipe.easycom.json +83 -0
  332. package/components/ste-touch-swipe/ste-touch-swipe.vue +283 -0
  333. package/components/ste-touch-swipe/useData.ts +51 -0
  334. package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +32 -0
  335. package/components/ste-tour/ATTRIBUTES.md +26 -0
  336. package/components/ste-tour/README.md +134 -0
  337. package/components/ste-tour/config.json +5 -0
  338. package/components/ste-tour/props.ts +45 -0
  339. package/components/ste-tour/ste-tour.easycom.json +120 -0
  340. package/components/ste-tour/ste-tour.vue +152 -0
  341. package/components/ste-tour/useData.ts +220 -0
  342. package/components/ste-tree/ATTRIBUTES.md +19 -0
  343. package/components/ste-tree/README.md +217 -0
  344. package/components/ste-tree/config.json +5 -0
  345. package/components/ste-tree/props.ts +24 -0
  346. package/components/ste-tree/ste-tree.easycom.json +106 -0
  347. package/components/ste-tree/ste-tree.vue +140 -0
  348. package/components/ste-tree/useData.ts +219 -0
  349. package/components/ste-upload/ATTRIBUTES.md +35 -0
  350. package/components/ste-upload/README.md +208 -0
  351. package/components/ste-upload/ReadFile.ts +305 -0
  352. package/components/ste-upload/config.json +5 -0
  353. package/components/ste-upload/props.ts +25 -0
  354. package/components/ste-upload/ste-upload.easycom.json +267 -0
  355. package/components/ste-upload/ste-upload.vue +386 -0
  356. package/components/ste-upload/useData.ts +46 -0
  357. package/components/ste-video/ATTRIBUTES.md +34 -0
  358. package/components/ste-video/README.md +48 -0
  359. package/components/ste-video/config.json +5 -0
  360. package/components/ste-video/props.ts +86 -0
  361. package/components/ste-video/ste-video.easycom.json +226 -0
  362. package/components/ste-video/ste-video.scss +201 -0
  363. package/components/ste-video/ste-video.vue +390 -0
  364. package/components/ste-video/types.d.ts +4 -0
  365. package/components/ste-video/useData.ts +140 -0
  366. package/composables.ts +2 -0
  367. package/config/color.ts +16 -0
  368. package/config/index.ts +48 -0
  369. package/index.ts +118 -0
  370. package/package.json +22 -0
  371. package/store/color.ts +24 -0
  372. package/store/index.ts +12 -0
  373. package/store/message-box.ts +54 -0
  374. package/store/toast.ts +50 -0
  375. package/types/components.d.ts +124 -0
  376. package/types/event.d.ts +51 -0
  377. package/types/index.d.ts +112 -0
  378. package/types/refComponents.d.ts +118 -0
  379. package/utils/Color.ts +66 -0
  380. package/utils/System.ts +114 -0
  381. package/utils/mixin.ts +122 -0
  382. package/utils/utils.ts +520 -0
@@ -0,0 +1,317 @@
1
+ const CHAR_TILDE = 126
2
+
3
+ const SET_STARTA = 103
4
+ const SET_STARTB = 104
5
+ const SET_STARTC = 105
6
+ const SET_SHIFT = 98
7
+ const SET_CODEA = 101
8
+ const SET_CODEB = 100
9
+ const SET_STOP = 106
10
+
11
+ const CODESET = {
12
+ ANY: 1,
13
+ AB: 2,
14
+ A: 3,
15
+ B: 4,
16
+ C: 5,
17
+ }
18
+
19
+ export const PATTERNS = [
20
+ [2, 1, 2, 2, 2, 2, 0, 0], // 0
21
+ [2, 2, 2, 1, 2, 2, 0, 0], // 1
22
+ [2, 2, 2, 2, 2, 1, 0, 0], // 2
23
+ [1, 2, 1, 2, 2, 3, 0, 0], // 3
24
+ [1, 2, 1, 3, 2, 2, 0, 0], // 4
25
+ [1, 3, 1, 2, 2, 2, 0, 0], // 5
26
+ [1, 2, 2, 2, 1, 3, 0, 0], // 6
27
+ [1, 2, 2, 3, 1, 2, 0, 0], // 7
28
+ [1, 3, 2, 2, 1, 2, 0, 0], // 8
29
+ [2, 2, 1, 2, 1, 3, 0, 0], // 9
30
+ [2, 2, 1, 3, 1, 2, 0, 0], // 10
31
+ [2, 3, 1, 2, 1, 2, 0, 0], // 11
32
+ [1, 1, 2, 2, 3, 2, 0, 0], // 12
33
+ [1, 2, 2, 1, 3, 2, 0, 0], // 13
34
+ [1, 2, 2, 2, 3, 1, 0, 0], // 14
35
+ [1, 1, 3, 2, 2, 2, 0, 0], // 15
36
+ [1, 2, 3, 1, 2, 2, 0, 0], // 16
37
+ [1, 2, 3, 2, 2, 1, 0, 0], // 17
38
+ [2, 2, 3, 2, 1, 1, 0, 0], // 18
39
+ [2, 2, 1, 1, 3, 2, 0, 0], // 19
40
+ [2, 2, 1, 2, 3, 1, 0, 0], // 20
41
+ [2, 1, 3, 2, 1, 2, 0, 0], // 21
42
+ [2, 2, 3, 1, 1, 2, 0, 0], // 22
43
+ [3, 1, 2, 1, 3, 1, 0, 0], // 23
44
+ [3, 1, 1, 2, 2, 2, 0, 0], // 24
45
+ [3, 2, 1, 1, 2, 2, 0, 0], // 25
46
+ [3, 2, 1, 2, 2, 1, 0, 0], // 26
47
+ [3, 1, 2, 2, 1, 2, 0, 0], // 27
48
+ [3, 2, 2, 1, 1, 2, 0, 0], // 28
49
+ [3, 2, 2, 2, 1, 1, 0, 0], // 29
50
+ [2, 1, 2, 1, 2, 3, 0, 0], // 30
51
+ [2, 1, 2, 3, 2, 1, 0, 0], // 31
52
+ [2, 3, 2, 1, 2, 1, 0, 0], // 32
53
+ [1, 1, 1, 3, 2, 3, 0, 0], // 33
54
+ [1, 3, 1, 1, 2, 3, 0, 0], // 34
55
+ [1, 3, 1, 3, 2, 1, 0, 0], // 35
56
+ [1, 1, 2, 3, 1, 3, 0, 0], // 36
57
+ [1, 3, 2, 1, 1, 3, 0, 0], // 37
58
+ [1, 3, 2, 3, 1, 1, 0, 0], // 38
59
+ [2, 1, 1, 3, 1, 3, 0, 0], // 39
60
+ [2, 3, 1, 1, 1, 3, 0, 0], // 40
61
+ [2, 3, 1, 3, 1, 1, 0, 0], // 41
62
+ [1, 1, 2, 1, 3, 3, 0, 0], // 42
63
+ [1, 1, 2, 3, 3, 1, 0, 0], // 43
64
+ [1, 3, 2, 1, 3, 1, 0, 0], // 44
65
+ [1, 1, 3, 1, 2, 3, 0, 0], // 45
66
+ [1, 1, 3, 3, 2, 1, 0, 0], // 46
67
+ [1, 3, 3, 1, 2, 1, 0, 0], // 47
68
+ [3, 1, 3, 1, 2, 1, 0, 0], // 48
69
+ [2, 1, 1, 3, 3, 1, 0, 0], // 49
70
+ [2, 3, 1, 1, 3, 1, 0, 0], // 50
71
+ [2, 1, 3, 1, 1, 3, 0, 0], // 51
72
+ [2, 1, 3, 3, 1, 1, 0, 0], // 52
73
+ [2, 1, 3, 1, 3, 1, 0, 0], // 53
74
+ [3, 1, 1, 1, 2, 3, 0, 0], // 54
75
+ [3, 1, 1, 3, 2, 1, 0, 0], // 55
76
+ [3, 3, 1, 1, 2, 1, 0, 0], // 56
77
+ [3, 1, 2, 1, 1, 3, 0, 0], // 57
78
+ [3, 1, 2, 3, 1, 1, 0, 0], // 58
79
+ [3, 3, 2, 1, 1, 1, 0, 0], // 59
80
+ [3, 1, 4, 1, 1, 1, 0, 0], // 60
81
+ [2, 2, 1, 4, 1, 1, 0, 0], // 61
82
+ [4, 3, 1, 1, 1, 1, 0, 0], // 62
83
+ [1, 1, 1, 2, 2, 4, 0, 0], // 63
84
+ [1, 1, 1, 4, 2, 2, 0, 0], // 64
85
+ [1, 2, 1, 1, 2, 4, 0, 0], // 65
86
+ [1, 2, 1, 4, 2, 1, 0, 0], // 66
87
+ [1, 4, 1, 1, 2, 2, 0, 0], // 67
88
+ [1, 4, 1, 2, 2, 1, 0, 0], // 68
89
+ [1, 1, 2, 2, 1, 4, 0, 0], // 69
90
+ [1, 1, 2, 4, 1, 2, 0, 0], // 70
91
+ [1, 2, 2, 1, 1, 4, 0, 0], // 71
92
+ [1, 2, 2, 4, 1, 1, 0, 0], // 72
93
+ [1, 4, 2, 1, 1, 2, 0, 0], // 73
94
+ [1, 4, 2, 2, 1, 1, 0, 0], // 74
95
+ [2, 4, 1, 2, 1, 1, 0, 0], // 75
96
+ [2, 2, 1, 1, 1, 4, 0, 0], // 76
97
+ [4, 1, 3, 1, 1, 1, 0, 0], // 77
98
+ [2, 4, 1, 1, 1, 2, 0, 0], // 78
99
+ [1, 3, 4, 1, 1, 1, 0, 0], // 79
100
+ [1, 1, 1, 2, 4, 2, 0, 0], // 80
101
+ [1, 2, 1, 1, 4, 2, 0, 0], // 81
102
+ [1, 2, 1, 2, 4, 1, 0, 0], // 82
103
+ [1, 1, 4, 2, 1, 2, 0, 0], // 83
104
+ [1, 2, 4, 1, 1, 2, 0, 0], // 84
105
+ [1, 2, 4, 2, 1, 1, 0, 0], // 85
106
+ [4, 1, 1, 2, 1, 2, 0, 0], // 86
107
+ [4, 2, 1, 1, 1, 2, 0, 0], // 87
108
+ [4, 2, 1, 2, 1, 1, 0, 0], // 88
109
+ [2, 1, 2, 1, 4, 1, 0, 0], // 89
110
+ [2, 1, 4, 1, 2, 1, 0, 0], // 90
111
+ [4, 1, 2, 1, 2, 1, 0, 0], // 91
112
+ [1, 1, 1, 1, 4, 3, 0, 0], // 92
113
+ [1, 1, 1, 3, 4, 1, 0, 0], // 93
114
+ [1, 3, 1, 1, 4, 1, 0, 0], // 94
115
+ [1, 1, 4, 1, 1, 3, 0, 0], // 95
116
+ [1, 1, 4, 3, 1, 1, 0, 0], // 96
117
+ [4, 1, 1, 1, 1, 3, 0, 0], // 97
118
+ [4, 1, 1, 3, 1, 1, 0, 0], // 98
119
+ [1, 1, 3, 1, 4, 1, 0, 0], // 99
120
+ [1, 1, 4, 1, 3, 1, 0, 0], // 100
121
+ [3, 1, 1, 1, 4, 1, 0, 0], // 101
122
+ [4, 1, 1, 1, 3, 1, 0, 0], // 102
123
+ [2, 1, 1, 4, 1, 2, 0, 0], // 103
124
+ [2, 1, 1, 2, 1, 4, 0, 0], // 104
125
+ [2, 1, 1, 2, 3, 2, 0, 0], // 105
126
+ [2, 3, 3, 1, 1, 1, 2, 0], // 106
127
+ ]
128
+
129
+ function getBytes(str: string) {
130
+ const bytes = []
131
+ for (let i = 0; i < str.length; i++)
132
+ bytes.push(str.charCodeAt(i))
133
+
134
+ return bytes
135
+ }
136
+
137
+ export function stringToCode128(text: string) {
138
+ const barc = {
139
+ currcs: CODESET.C,
140
+ }
141
+
142
+ const bytes = getBytes(text)
143
+ // decide starting codeset
144
+ let index = bytes[0] === CHAR_TILDE ? 1 : 0
145
+
146
+ const csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB
147
+ const csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB
148
+ barc.currcs = getBestStartSet(csa1, csa2)
149
+ barc.currcs = perhapsCodeC(bytes, barc.currcs)
150
+
151
+ // if no codeset changes this will end up with bytes.length+3
152
+ // start, checksum and stop
153
+ let codes = []
154
+
155
+ switch (barc.currcs) {
156
+ case CODESET.A:
157
+ codes.push(SET_STARTA)
158
+ break
159
+ case CODESET.B:
160
+ codes.push(SET_STARTB)
161
+ break
162
+ default:
163
+ codes.push(SET_STARTC)
164
+ break
165
+ }
166
+
167
+ for (let i = 0; i < bytes.length; i++) {
168
+ const b1 = bytes[i] // get the first of a pair
169
+
170
+ // get the next in the pair if possible
171
+ const b2 = bytes.length > i + 1 ? bytes[i + 1] : -1
172
+
173
+ codes = codes.concat(codesForChar(b1, b2, barc.currcs))
174
+ // code C takes 2 chars each time
175
+ if (barc.currcs === CODESET.C)
176
+ i++
177
+ }
178
+
179
+ // calculate checksum according to Code 128 standards
180
+ let checksum = codes[0]
181
+ for (let weight = 1; weight < codes.length; weight++)
182
+ checksum += weight * codes[weight]
183
+
184
+ codes.push(checksum % 103)
185
+
186
+ codes.push(SET_STOP)
187
+
188
+ // encoding should now be complete
189
+ return codes
190
+
191
+ function getBestStartSet(csa1: number, csa2: number) {
192
+ // tries to figure out the best codeset
193
+ // to start with to get the most compact code
194
+ let vote = 0
195
+ vote += csa1 === CODESET.A ? 1 : 0
196
+ vote += csa1 === CODESET.B ? -1 : 0
197
+ vote += csa2 === CODESET.A ? 1 : 0
198
+ vote += csa2 === CODESET.B ? -1 : 0
199
+ // tie goes to B due to my own predudices
200
+ return vote > 0 ? CODESET.A : CODESET.B
201
+ }
202
+
203
+ function perhapsCodeC(bytes: number[], codeset: number) {
204
+ for (let i = 0; i < bytes.length; i++) {
205
+ const b = bytes[i]
206
+ if ((b < 48 || b > 57) && b !== CHAR_TILDE)
207
+ return codeset
208
+ }
209
+ return CODESET.C
210
+ }
211
+
212
+ // chr1 is current byte
213
+ // chr2 is the next byte to process. looks ahead.
214
+ function codesForChar(chr1: number, chr2: number, currcs: number) {
215
+ const result = []
216
+ let shifter = -1
217
+
218
+ if (charCompatible(chr1, currcs)) {
219
+ /* eslint-disable no-unused-expressions */
220
+ if (currcs === CODESET.C) {
221
+ if (chr2 === -1) {
222
+ shifter === SET_CODEB
223
+ currcs = CODESET.B
224
+ }
225
+ else if (chr2 !== -1 && !charCompatible(chr2, currcs)) {
226
+ // need to check ahead as well
227
+ if (charCompatible(chr2, CODESET.A)) {
228
+ shifter = SET_CODEA
229
+ currcs = CODESET.A
230
+ }
231
+ else {
232
+ shifter = SET_CODEB
233
+ currcs = CODESET.B
234
+ }
235
+ }
236
+ }
237
+ /* eslint-enable no-unused-expressions */
238
+ }
239
+ else {
240
+ // if there is a next char AND that next char is also not compatible
241
+
242
+ if (chr2 !== -1 && !charCompatible(chr2, currcs)) {
243
+ // need to switch code sets
244
+ switch (currcs) {
245
+ case CODESET.A:
246
+ shifter = SET_CODEB
247
+ currcs = CODESET.B
248
+ break
249
+ case CODESET.B:
250
+ shifter = SET_CODEA
251
+ currcs = CODESET.A
252
+ break
253
+ }
254
+ }
255
+ else {
256
+ // no need to shift code sets, a temporary SHIFT will suffice
257
+ shifter = SET_SHIFT
258
+ }
259
+ }
260
+
261
+ // ok some type of shift is nessecary
262
+ if (shifter !== -1) {
263
+ result.push(shifter)
264
+ // result.push(codeValue(chr2));-----------------------------------
265
+ result.push(codeValue(chr1))
266
+ }
267
+ else {
268
+ if (currcs === CODESET.C) {
269
+ // include next as well
270
+ result.push(codeValue(chr1, chr2))
271
+ }
272
+ else {
273
+ result.push(codeValue(chr1))
274
+ }
275
+ }
276
+ barc.currcs = currcs
277
+
278
+ return result
279
+ }
280
+ }
281
+
282
+ // reduce the ascii code to fit into the Code128 char table
283
+ function codeValue(chr1: number, chr2: any = undefined) {
284
+ if (typeof chr2 === 'undefined')
285
+ return chr1 >= 32 ? chr1 - 32 : chr1 + 64
286
+ else
287
+ return Number.parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2))
288
+ }
289
+
290
+ function charCompatible(chr: number, codeset: number) {
291
+ const csa = codeSetAllowedFor(chr)
292
+ if (csa === CODESET.ANY)
293
+ return true
294
+ // if we need to change from current
295
+ if (csa === CODESET.AB)
296
+ return true
297
+ if (csa === CODESET.A && codeset === CODESET.A)
298
+ return true
299
+ if (csa === CODESET.B && codeset === CODESET.B)
300
+ return true
301
+ return false
302
+ }
303
+
304
+ function codeSetAllowedFor(chr: number) {
305
+ if (chr >= 48 && chr <= 57) {
306
+ // 0-9
307
+ return CODESET.ANY
308
+ }
309
+ else if (chr >= 32 && chr <= 95) {
310
+ // 0-9 A-Z
311
+ return CODESET.AB
312
+ }
313
+ else {
314
+ // if non printable
315
+ return chr < 32 ? CODESET.A : CODESET.B
316
+ }
317
+ }
@@ -0,0 +1,7 @@
1
+ export default {
2
+ content: { type: String, required: true },
3
+ width: { type: Number, default: 300 },
4
+ height: { type: Number, default: 100 },
5
+ background: { type: String, default: '#FFFFFF' },
6
+ foreground: { type: String, default: '#000000' },
7
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "ste-barcode",
3
+ "description": "条形码组件",
4
+ "example": "<ste-barcode content='1234567890'></ste-barcode>",
5
+ "tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=barcode",
6
+ "attributes": [
7
+ {
8
+ "name": "content",
9
+ "description": "条形码内容(仅支持数字和字母)",
10
+ "type": "string"
11
+ },
12
+ {
13
+ "name": "width",
14
+ "description": "条形码宽度,单位`px`",
15
+ "type": "number"
16
+ },
17
+ {
18
+ "name": "height",
19
+ "description": "条形码高度,单位`px`",
20
+ "type": "number"
21
+ },
22
+ {
23
+ "name": "background",
24
+ "description": "背景色",
25
+ "type": "string"
26
+ },
27
+ {
28
+ "name": "foreground",
29
+ "description": "前景色(条形码画笔颜色)",
30
+ "type": "string"
31
+ },
32
+ {
33
+ "name": "[event]loadImage",
34
+ "description": "加载完成后返回条形码对应的图片数据",
35
+ "type": "(src:string r) => void",
36
+ "params": [
37
+ {
38
+ "name": "src",
39
+ "description": "图片数据"
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,152 @@
1
+ <script setup lang="ts">
2
+ import utils from '../../utils/utils';
3
+ import { ref, onMounted, watch, nextTick, defineOptions, getCurrentInstance, type ComponentPublicInstance } from 'vue';
4
+ import propsData from './props';
5
+ import { PATTERNS, stringToCode128 } from './encode';
6
+
7
+ const componentName = `ste-barcode`;
8
+ defineOptions({
9
+ name: componentName,
10
+ options: {
11
+ virtualHost: true,
12
+ },
13
+ });
14
+ const instance = getCurrentInstance() as unknown as ComponentPublicInstance;
15
+ const props = defineProps(propsData);
16
+ const canvasId = 'ste-barcode-' + utils.guid(8);
17
+
18
+ onMounted(() => {
19
+ initCanvas();
20
+ });
21
+
22
+ watch(
23
+ () => props.content,
24
+ val => {
25
+ if (!val) return;
26
+ initCanvas();
27
+ },
28
+ {}
29
+ );
30
+
31
+ const initCanvas = () => {
32
+ // #ifdef H5 || APP
33
+ const context = uni.createCanvasContext(canvasId, instance);
34
+ drawBarcodeH5(context);
35
+ // #endif
36
+
37
+ // #ifdef MP-WEIXIN || MP-ALIPAY
38
+ uni.createSelectorQuery()
39
+ .in(instance)
40
+ .select(`#${canvasId}`)
41
+ .node(res => {
42
+ const context = res.node.getContext('2d');
43
+ const dpr = utils.System.getWindowInfo().pixelRatio;
44
+ res.node.width = props.width * dpr;
45
+ res.node.height = props.height * dpr;
46
+ context.scale(dpr, dpr);
47
+ drawBarcodeMP(context);
48
+ })
49
+ .exec();
50
+ // #endif
51
+ };
52
+
53
+ // 将 PATTERNS 码序列转换为二进制序列
54
+ const patternsToBinary = (codes: number[]) => {
55
+ let binary = '';
56
+ for (let i = 0; i < codes.length; i++) {
57
+ const pattern = PATTERNS[codes[i]];
58
+ for (let j = 0; j < 8; j += 2) {
59
+ // 添加黑色条
60
+ binary += '1'.repeat(pattern[j]);
61
+ // 添加白色空格
62
+ if (j + 1 < 8) {
63
+ binary += '0'.repeat(pattern[j + 1]);
64
+ }
65
+ }
66
+ }
67
+ return binary;
68
+ };
69
+
70
+ // H5环境下的绘制方法
71
+ const drawBarcodeH5 = (context: UniApp.CanvasContext) => {
72
+ if (!props.content) return;
73
+ // 生成编码数据
74
+ const codes = stringToCode128(props.content);
75
+ if (!codes || codes.length === 0) {
76
+ return;
77
+ }
78
+
79
+ // 转换为二进制序列
80
+ const barcodeData = patternsToBinary(codes);
81
+
82
+ // 清空画布
83
+ context.setFillStyle(props.background);
84
+ context.fillRect(0, 0, props.width, props.height);
85
+
86
+ // 设置条码颜色
87
+ context.setFillStyle(props.foreground);
88
+
89
+ // 直接使用画布宽度,不考虑边距
90
+ const unitWidth = props.width / barcodeData.length;
91
+
92
+ // 绘制条码
93
+ let x = 0;
94
+ for (let i = 0; i < barcodeData.length; i++) {
95
+ if (barcodeData[i] === '1') {
96
+ context.fillRect(x, 0, Math.ceil(unitWidth), props.height);
97
+ }
98
+ x += unitWidth;
99
+ }
100
+
101
+ context.draw();
102
+ };
103
+
104
+ // 小程序环境下的绘制方法
105
+ const drawBarcodeMP = (context: UniApp.CanvasContext) => {
106
+ if (!context || !props.content) return;
107
+
108
+ const codes = stringToCode128(props.content);
109
+ if (!codes || codes.length === 0) return;
110
+
111
+ // 清空画布
112
+ context.fillStyle = props.background;
113
+ context.fillRect(0, 0, props.width, props.height);
114
+
115
+ const barWeight = props.width / ((codes.length - 3) * 11 + 35);
116
+ let x = 0;
117
+
118
+ // 绘制条码
119
+ context.fillStyle = props.foreground;
120
+ for (let i = 0; i < codes.length; i++) {
121
+ const pattern = PATTERNS[codes[i]];
122
+ for (let bar = 0; bar < 8; bar += 2) {
123
+ const barW = pattern[bar] * barWeight;
124
+ if (barW > 0) {
125
+ context.fillRect(x, 0, barW, props.height);
126
+ }
127
+ x += barW + pattern[bar + 1] * barWeight;
128
+ }
129
+ }
130
+ };
131
+ </script>
132
+
133
+ <template>
134
+ <view class="ste-barcode-root">
135
+ <!-- #ifdef H5 || APP -->
136
+ <canvas :style="{ width: width + 'px', height: height + 'px' }" :canvas-id="canvasId" :id="canvasId" class="h5-canvas"></canvas>
137
+ <!-- #endif -->
138
+
139
+ <!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
140
+ <canvas type="2d" :id="canvasId" :style="{ width: width + 'px', height: height + 'px' }" class="mp-canvas"></canvas>
141
+ <!-- #endif -->
142
+ </view>
143
+ </template>
144
+
145
+ <style lang="scss" scoped>
146
+ .ste-barcode-root {
147
+ width: fit-content;
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+ }
152
+ </style>
@@ -0,0 +1,32 @@
1
+ #### Props
2
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
+ | ----- | ----- | --- | ------- | ------ | -------- |
4
+ | `mode` | 尺寸 | `number` | `200` | `100`:小<br/>`200`:中<br/>`300`:大<br/>`400`:超大 | - |
5
+ | `color` | 文本颜色 | `string` | `#ffffff` | - | - |
6
+ | `background` | 背景 | `string` | `#0090FF` | - | - |
7
+ | `borderColor` | 边框颜色 | `string` | - | - | - |
8
+ | `width` | 宽度 | `string / number` | `auto` | `auto`:自适应宽度<br/>`100%`:填满<br/>`{Number}`:自适应宽度,单位rpx | - |
9
+ | `round` | 是否圆角按钮 | `boolean` | `false` | - | - |
10
+ | `disabled` | 是否禁用状态 | `boolean` | `false` | - | - |
11
+ | `loading` | 是否加载中状态 | `boolean` | `false` | - | - |
12
+ | `stopPropagation` | 是否阻止冒泡行为 | `boolean` | `false` | - | - |
13
+ | `openType` | 微信开放能力和支付宝开放能力 | `string` | - | - | - |
14
+ | `scope` | 支付宝开放能力,当 openType 为 getAuthorize 时有效 | `string` | - | - | - |
15
+ | `rootStyle` | 按钮样式属性 | `object` | - | - | - |
16
+
17
+
18
+ #### Events
19
+ | 事件名 | 说明 | 事件参数 | 支持版本 |
20
+ | ----- | ----- | ------- | -------- |
21
+ | `click` | 非禁止并且非加载中,才能点击 | - | - |
22
+ | `getuserinfo` | 微信小程序:用户点击该按钮时,会返回获取到的用户信息,从返回参数的 detail 中获取到的值同 wx.getUserInfo。支付宝小程序:当 open-type 为 getAuthorize 且 scope 为 userInfo 时有效。当授权成功时触发。 | - | - |
23
+ | `contact` | 微信小程序:客服消息回调,open-type="contact"时有效。 | - | - |
24
+ | `getphonenumber` | 微信小程序:手机号快速验证回调,open-type=getPhoneNumber时有效。Tips:在触发 bindgetphonenumber 回调后应立即隐藏手机号按钮组件,或置为 disabled 状态,避免用户重复授权手机号产生额外费用。支付宝小程序:当 open-type 为 getAuthorize 且 scope 为 phoneNumber 时有效。当授权成功时触发。 | - | - |
25
+ | `getrealtimephonenumber` | 微信小程序:手机号实时验证回调,open-type=getRealtimePhoneNumber 时有效。Tips:在触发 bindgetrealtimephonenumber 回调后应立即隐藏手机号按钮组件,或置为 disabled 状态,避免用户重复授权手机号产生额外费用。 | - | - |
26
+ | `agreeprivacyauthorization` | 微信小程序:用户同意隐私协议事件回调,open-type=agreePrivacyAuthorization时有效 (Tips: 如果使用 onNeedPrivacyAuthorization 接口,需要在 bindagreeprivacyauthorization 触发后再调用 resolve({ event: "agree", buttonId })) | - | - |
27
+ | `error` | 微信小程序:当使用开放能力时,发生错误的回调,open-type=launchApp时有效 支付宝小程序:当 open-type 为 getAuthorize 时有效。当授权失败时触发。event.detail = {type, errorMessage},此时 type 的值为 getAuthorize。 | - | - |
28
+ | `launchapp` | 微信小程序:打开 APP 成功的回调,open-type=launchApp时有效 | - | - |
29
+ | `opensetting` | 微信小程序:在打开授权设置页后回调,open-type=openSetting时有效 | - | - |
30
+ | `chooseavatar` | 微信小程序:获取用户头像回调,open-type=chooseAvatar时有效。返回 e.detail.avatarUrl 为头像临时文件链接。 | - | - |
31
+ | `getAuthorize` | 支付宝小程序:当 open-type 为 getAuthorize 时有效。当授权成功时触发。 | - | - |
32
+ | `followLifestyle` | 支付宝小程序:当 open-type 为 lifestyle 时有效。当点击按钮时触发。event.detail = { followStatus },folllowStatus 合法值有 1、2、3,其中 1 表示已关注。2 表示用户不允许关注。3 表示发生未知错误;。 | - | - |
@@ -0,0 +1,119 @@
1
+ # Button 按钮
2
+
3
+ 基础按钮组件
4
+
5
+ ---$
6
+
7
+ ### 代码演示
8
+
9
+ #### 按钮大小
10
+
11
+ 通过`mode`设置按钮的大小,默认值是`200`
12
+
13
+ ```html
14
+ <ste-button :mode="400">超大按钮</ste-button>
15
+ <ste-button :mode="300">大按钮</ste-button>
16
+ <ste-button>中按钮</ste-button>
17
+ <ste-button :mode="100">小按钮</ste-button>
18
+ ```
19
+
20
+ #### 文本颜色
21
+
22
+ 通过`color`设置字体颜色
23
+
24
+ ```html
25
+ <ste-button :color="'#000000'">文本颜色按钮</ste-button>
26
+ ```
27
+
28
+ #### 背景
29
+
30
+ 通过`background`设置背景,支持纯颜色、背景图、渐变色
31
+
32
+ ```html
33
+ <ste-button background="#ff1e19">按钮</ste-button>
34
+ <ste-button background="https://image.whzb.com/chain/StellarUI/image/精选会员瓷片.png">背景图</ste-button>
35
+ <ste-button background="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))">渐变色</ste-button>
36
+ ```
37
+
38
+ #### 边框颜色
39
+
40
+ 通过`borderColor`设置边框颜色,默认值是`#ffffff`
41
+
42
+ ```html
43
+ <ste-button borderColor="#ff1e19">文本颜色按钮</ste-button>
44
+ ```
45
+
46
+ #### 宽度
47
+
48
+ 通过`width`设置宽度,默认值是`auto`
49
+
50
+ - 设置值为`100%`,填满父容器
51
+ - 设置具体值时,按具体数值的宽度,单位是rpx
52
+
53
+ ```html
54
+ <ste-button width="100%">宽度填满</ste-button>
55
+ <ste-button width="500">自定义宽度-500rpx</ste-button>
56
+ <ste-button>自适应宽度</ste-button>
57
+ ```
58
+
59
+ #### 圆角按钮
60
+
61
+ 通过`round`设置按钮是否为圆角,默认值是`true`
62
+
63
+ ```html
64
+ <ste-button>圆角按钮</ste-button>
65
+ <ste-button :round="false">非圆角按钮</ste-button>
66
+ ```
67
+
68
+ #### 禁止按钮
69
+
70
+ 通过`disabled`设置按钮是否禁止,默认值是`false`
71
+
72
+ ```html
73
+ <ste-button disabled>禁止按钮</ste-button>
74
+ ```
75
+
76
+ #### 加载中
77
+
78
+ 通过`loading`设置是否加载中,默认值是`false`
79
+
80
+ - `loading`值是`true`时不允许点击,且按钮内容会变成`加载中......`
81
+
82
+ ```html
83
+ <ste-button loading>按钮</ste-button>
84
+ ```
85
+
86
+ #### 插槽
87
+
88
+ ```html
89
+ <ste-button>
90
+ <text style="display: inline-block">
91
+ <ste-icon code="&#xe68f;" :size="32" :color="'#ffffff'" :marginRight="8"></ste-icon>
92
+ </text>
93
+ <text>购卡</text>
94
+ </ste-button>
95
+ <ste-button>提交订单</ste-button>
96
+ ```
97
+
98
+ #### 超长文字
99
+
100
+ ```html
101
+ <ste-button width="100%">提交-按钮按钮按钮按钮按钮按钮按钮按钮按钮按钮按钮按钮</ste-button>
102
+ ```
103
+
104
+ ---$
105
+
106
+ ### API
107
+
108
+ <!-- props -->
109
+
110
+ #### Slots
111
+
112
+ | 插槽名 | 说明 | 插槽参数 | 支持版本 |
113
+ | --------- | -------- | -------- | -------- |
114
+ | `default` | 按钮内容 | - | - |
115
+
116
+ ---$
117
+ {{fuyuwei}}
118
+
119
+ {{qinpengfei}}
@@ -0,0 +1,5 @@
1
+ {
2
+ "group": "基础组件",
3
+ "title": "Button 按钮",
4
+ "icon": "https://image.whzb.com/chain/StellarUI/%E7%BB%84%E4%BB%B6%E5%9B%BE%E6%A0%87/button.png"
5
+ }