@kengic/uni 0.3.2-beta.3 → 0.3.2-beta.5

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 (255) hide show
  1. package/dist/kengic-uni.js +2 -1371
  2. package/dist/src/index.d.ts +0 -1
  3. package/dist/uni-ui/index.ts +5 -0
  4. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  5. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  6. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  7. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  8. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  9. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  10. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  11. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  12. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  13. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  14. package/dist/uni-ui/uni-calendar/util.js +360 -0
  15. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  16. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  17. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  18. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  19. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  20. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  21. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  22. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  23. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  24. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  25. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  26. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  27. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  28. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  29. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  30. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  31. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  32. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  33. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  34. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  35. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  36. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  37. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  38. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  39. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  40. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  41. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  42. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  43. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  44. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  45. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  46. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  47. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  48. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  49. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  50. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  51. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  52. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  53. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  54. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  55. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  56. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  57. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  58. package/dist/uni-ui/uni-forms/utils.js +293 -0
  59. package/dist/uni-ui/uni-forms/validate.js +486 -0
  60. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  61. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  62. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  63. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  64. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  65. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  66. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  67. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  68. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  69. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  70. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  71. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  72. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  73. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  74. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  75. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  76. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  77. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  78. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  79. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  80. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  81. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  82. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  83. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  84. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  85. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  86. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  87. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  88. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  89. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  90. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  91. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  92. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  93. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  94. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  95. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  96. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  97. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  98. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  99. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  100. package/dist/uni-ui/uni-popup/i18n/index.js +8 -0
  101. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  102. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  103. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  104. package/dist/uni-ui/uni-popup/popup.js +26 -0
  105. package/dist/uni-ui/uni-popup/uni-popup.vue +473 -0
  106. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  107. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  108. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  109. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  110. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  111. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  112. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  113. package/dist/uni-ui/uni-scss/index.scss +1 -0
  114. package/dist/uni-ui/uni-scss/package.json +82 -0
  115. package/dist/uni-ui/uni-scss/readme.md +4 -0
  116. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  117. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  118. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  119. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  120. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  121. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  122. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  123. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  124. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  125. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  126. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  127. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  128. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  129. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  130. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  131. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  132. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  133. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  134. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  135. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  136. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  137. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  138. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  139. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  140. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  141. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  142. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  143. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  144. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  145. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  146. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  147. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  148. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  149. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  150. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  151. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  152. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  153. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  154. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  155. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  156. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  157. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  158. package/package.json +10 -10
  159. package/dist/index.css +0 -1
  160. package/dist/src/components/index.d.ts +0 -5
  161. package/dist/src/components/uni-ui/uni-badge/uni-badge.vue.d.ts +0 -108
  162. package/dist/src/components/uni-ui/uni-breadcrumb/uni-breadcrumb.vue.d.ts +0 -23
  163. package/dist/src/components/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue.d.ts +0 -30
  164. package/dist/src/components/uni-ui/uni-calendar/calendar.d.ts +0 -67
  165. package/dist/src/components/uni-ui/uni-calendar/i18n/index.d.ts +0 -39
  166. package/dist/src/components/uni-ui/uni-calendar/uni-calendar-item.vue.d.ts +0 -47
  167. package/dist/src/components/uni-ui/uni-calendar/uni-calendar.vue.d.ts +0 -166
  168. package/dist/src/components/uni-ui/uni-calendar/util.d.ts +0 -211
  169. package/dist/src/components/uni-ui/uni-card/uni-card.vue.d.ts +0 -117
  170. package/dist/src/components/uni-ui/uni-col/uni-col.vue.d.ts +0 -70
  171. package/dist/src/components/uni-ui/uni-collapse/uni-collapse.vue.d.ts +0 -45
  172. package/dist/src/components/uni-ui/uni-collapse-item/uni-collapse-item.vue.d.ts +0 -102
  173. package/dist/src/components/uni-ui/uni-combox/uni-combox.vue.d.ts +0 -95
  174. package/dist/src/components/uni-ui/uni-countdown/i18n/index.d.ts +0 -21
  175. package/dist/src/components/uni-ui/uni-countdown/uni-countdown.vue.d.ts +0 -158
  176. package/dist/src/components/uni-ui/uni-data-checkbox/uni-data-checkbox.vue.d.ts +0 -192
  177. package/dist/src/components/uni-ui/uni-data-picker/uni-data-picker.vue.d.ts +0 -267
  178. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +0 -221
  179. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-pickerview.vue.d.ts +0 -169
  180. package/dist/src/components/uni-ui/uni-data-select/uni-data-select.vue.d.ts +0 -125
  181. package/dist/src/components/uni-ui/uni-dateformat/date-format.d.ts +0 -6
  182. package/dist/src/components/uni-ui/uni-dateformat/uni-dateformat.vue.d.ts +0 -57
  183. package/dist/src/components/uni-ui/uni-datetime-picker/calendar-item.vue.d.ts +0 -44
  184. package/dist/src/components/uni-ui/uni-datetime-picker/calendar.vue.d.ts +0 -253
  185. package/dist/src/components/uni-ui/uni-datetime-picker/i18n/index.d.ts +0 -69
  186. package/dist/src/components/uni-ui/uni-datetime-picker/time-picker.vue.d.ts +0 -225
  187. package/dist/src/components/uni-ui/uni-datetime-picker/uni-datetime-picker.vue.d.ts +0 -236
  188. package/dist/src/components/uni-ui/uni-datetime-picker/util.d.ts +0 -171
  189. package/dist/src/components/uni-ui/uni-drawer/keypress.d.ts +0 -14
  190. package/dist/src/components/uni-ui/uni-drawer/uni-drawer.vue.d.ts +0 -78
  191. package/dist/src/components/uni-ui/uni-easyinput/uni-easyinput.vue.d.ts +0 -269
  192. package/dist/src/components/uni-ui/uni-fab/uni-fab.vue.d.ts +0 -109
  193. package/dist/src/components/uni-ui/uni-fav/i18n/index.d.ts +0 -15
  194. package/dist/src/components/uni-ui/uni-fav/uni-fav.vue.d.ts +0 -99
  195. package/dist/src/components/uni-ui/uni-file-picker/choose-and-upload-file.d.ts +0 -4
  196. package/dist/src/components/uni-ui/uni-file-picker/uni-file-picker.vue.d.ts +0 -254
  197. package/dist/src/components/uni-ui/uni-file-picker/upload-file.vue.d.ts +0 -81
  198. package/dist/src/components/uni-ui/uni-file-picker/upload-image.vue.d.ts +0 -90
  199. package/dist/src/components/uni-ui/uni-file-picker/utils.d.ts +0 -22
  200. package/dist/src/components/uni-ui/uni-forms/uni-forms.vue.d.ts +0 -160
  201. package/dist/src/components/uni-ui/uni-forms/utils.d.ts +0 -20
  202. package/dist/src/components/uni-ui/uni-forms/validate.d.ts +0 -42
  203. package/dist/src/components/uni-ui/uni-forms-item/uni-forms-item.vue.d.ts +0 -127
  204. package/dist/src/components/uni-ui/uni-goods-nav/i18n/index.d.ts +0 -21
  205. package/dist/src/components/uni-ui/uni-goods-nav/uni-goods-nav.vue.d.ts +0 -61
  206. package/dist/src/components/uni-ui/uni-grid/uni-grid.vue.d.ts +0 -59
  207. package/dist/src/components/uni-ui/uni-grid-item/uni-grid-item.vue.d.ts +0 -26
  208. package/dist/src/components/uni-ui/uni-group/uni-group.vue.d.ts +0 -52
  209. package/dist/src/components/uni-ui/uni-icons/icons.d.ts +0 -15
  210. package/dist/src/components/uni-ui/uni-icons/uni-icons.vue.d.ts +0 -56
  211. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list-item.vue.d.ts +0 -45
  212. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list.vue.d.ts +0 -49
  213. package/dist/src/components/uni-ui/uni-link/uni-link.vue.d.ts +0 -75
  214. package/dist/src/components/uni-ui/uni-list/uni-list.vue.d.ts +0 -53
  215. package/dist/src/components/uni-ui/uni-list/uni-refresh.vue.d.ts +0 -22
  216. package/dist/src/components/uni-ui/uni-list-ad/uni-list-ad.vue.d.ts +0 -25
  217. package/dist/src/components/uni-ui/uni-list-chat/uni-list-chat.vue.d.ts +0 -123
  218. package/dist/src/components/uni-ui/uni-list-item/uni-list-item.vue.d.ts +0 -248
  219. package/dist/src/components/uni-ui/uni-load-more/i18n/index.d.ts +0 -18
  220. package/dist/src/components/uni-ui/uni-load-more/uni-load-more.vue.d.ts +0 -89
  221. package/dist/src/components/uni-ui/uni-nav-bar/uni-nav-bar.vue.d.ts +0 -163
  222. package/dist/src/components/uni-ui/uni-nav-bar/uni-status-bar.vue.d.ts +0 -4
  223. package/dist/src/components/uni-ui/uni-notice-bar/uni-notice-bar.vue.d.ts +0 -138
  224. package/dist/src/components/uni-ui/uni-number-box/uni-number-box.vue.d.ts +0 -90
  225. package/dist/src/components/uni-ui/uni-pagination/i18n/index.d.ts +0 -28
  226. package/dist/src/components/uni-ui/uni-pagination/uni-pagination.vue.d.ts +0 -127
  227. package/dist/src/components/uni-ui/uni-popup/i18n/index.d.ts +0 -24
  228. package/dist/src/components/uni-ui/uni-popup/keypress.d.ts +0 -14
  229. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +0 -17
  230. package/dist/src/components/uni-ui/uni-popup/uni-popup.vue.d.ts +0 -136
  231. package/dist/src/components/uni-ui/uni-popup-dialog/uni-popup-dialog.vue.d.ts +0 -123
  232. package/dist/src/components/uni-ui/uni-popup-message/uni-popup-message.vue.d.ts +0 -67
  233. package/dist/src/components/uni-ui/uni-popup-share/uni-popup-share.vue.d.ts +0 -49
  234. package/dist/src/components/uni-ui/uni-rate/uni-rate.vue.d.ts +0 -154
  235. package/dist/src/components/uni-ui/uni-row/uni-row.vue.d.ts +0 -41
  236. package/dist/src/components/uni-ui/uni-search-bar/i18n/index.d.ts +0 -15
  237. package/dist/src/components/uni-ui/uni-search-bar/uni-search-bar.vue.d.ts +0 -126
  238. package/dist/src/components/uni-ui/uni-section/uni-section.vue.d.ts +0 -85
  239. package/dist/src/components/uni-ui/uni-segmented-control/uni-segmented-control.vue.d.ts +0 -47
  240. package/dist/src/components/uni-ui/uni-steps/uni-steps.vue.d.ts +0 -59
  241. package/dist/src/components/uni-ui/uni-swipe-action/uni-swipe-action.vue.d.ts +0 -6
  242. package/dist/src/components/uni-ui/uni-swiper-dot/uni-swiper-dot.vue.d.ts +0 -65
  243. package/dist/src/components/uni-ui/uni-table/uni-table.vue.d.ts +0 -99
  244. package/dist/src/components/uni-ui/uni-tag/uni-tag.vue.d.ts +0 -84
  245. package/dist/src/components/uni-ui/uni-tbody/uni-tbody.vue.d.ts +0 -2
  246. package/dist/src/components/uni-ui/uni-td/uni-td.vue.d.ts +0 -48
  247. package/dist/src/components/uni-ui/uni-th/filter-dropdown.vue.d.ts +0 -99
  248. package/dist/src/components/uni-ui/uni-th/uni-th.vue.d.ts +0 -97
  249. package/dist/src/components/uni-ui/uni-thead/uni-thead.vue.d.ts +0 -15
  250. package/dist/src/components/uni-ui/uni-title/uni-title.vue.d.ts +0 -54
  251. package/dist/src/components/uni-ui/uni-tooltip/uni-tooltip.vue.d.ts +0 -23
  252. package/dist/src/components/uni-ui/uni-tr/table-checkbox.vue.d.ts +0 -58
  253. package/dist/src/components/uni-ui/uni-tr/uni-tr.vue.d.ts +0 -39
  254. package/dist/src/components/uni-ui/uni-transition/createAnimation.d.ts +0 -16
  255. package/dist/src/components/uni-ui/uni-transition/uni-transition.vue.d.ts +0 -240
@@ -0,0 +1,660 @@
1
+ <template>
2
+ <view class="uni-easyinput" :class="{ 'uni-easyinput-error': msg }" :style="boxStyle">
3
+ <view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
4
+ <uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc" @click="onClickIcon('prefix')" size="22"></uni-icons>
5
+ <textarea
6
+ v-if="type === 'textarea'"
7
+ class="uni-easyinput__content-textarea"
8
+ :class="{ 'input-padding': inputBorder }"
9
+ :name="name"
10
+ :value="val"
11
+ :placeholder="placeholder"
12
+ :placeholderStyle="placeholderStyle"
13
+ :disabled="disabled"
14
+ placeholder-class="uni-easyinput__placeholder-class"
15
+ :maxlength="inputMaxlength"
16
+ :focus="focused"
17
+ :autoHeight="autoHeight"
18
+ :cursor-spacing="cursorSpacing"
19
+ @input="onInput"
20
+ @blur="_Blur"
21
+ @focus="_Focus"
22
+ @confirm="onConfirm"
23
+ @keyboardheightchange="onkeyboardheightchange"
24
+ ></textarea>
25
+ <input
26
+ v-else
27
+ :type="type === 'password' ? 'text' : type"
28
+ class="uni-easyinput__content-input"
29
+ :style="inputStyle"
30
+ :name="name"
31
+ :value="val"
32
+ :password="!showPassword && type === 'password'"
33
+ :placeholder="placeholder"
34
+ :placeholderStyle="placeholderStyle"
35
+ placeholder-class="uni-easyinput__placeholder-class"
36
+ :disabled="disabled"
37
+ :maxlength="inputMaxlength"
38
+ :focus="focused"
39
+ :confirmType="confirmType"
40
+ :cursor-spacing="cursorSpacing"
41
+ @focus="_Focus"
42
+ @blur="_Blur"
43
+ @input="onInput"
44
+ @confirm="onConfirm"
45
+ @keyboardheightchange="onkeyboardheightchange"
46
+ />
47
+ <template v-if="type === 'password' && passwordIcon">
48
+ <!-- 开启密码时显示小眼睛 -->
49
+ <uni-icons
50
+ v-if="isVal"
51
+ class="content-clear-icon"
52
+ :class="{ 'is-textarea-icon': type === 'textarea' }"
53
+ :type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
54
+ :size="22"
55
+ :color="focusShow ? primaryColor : '#c0c4cc'"
56
+ @click="onEyes"
57
+ ></uni-icons>
58
+ </template>
59
+ <template v-else-if="suffixIcon">
60
+ <uni-icons v-if="suffixIcon" class="content-clear-icon" :type="suffixIcon" color="#c0c4cc" @click="onClickIcon('suffix')" size="22"></uni-icons>
61
+ </template>
62
+ <template v-else>
63
+ <uni-icons
64
+ v-if="clearable && isVal && !disabled && type !== 'textarea'"
65
+ class="content-clear-icon"
66
+ :class="{ 'is-textarea-icon': type === 'textarea' }"
67
+ type="clear"
68
+ :size="clearSize"
69
+ :color="msg ? '#dd524d' : focusShow ? primaryColor : '#c0c4cc'"
70
+ @click="onClear"
71
+ ></uni-icons>
72
+ </template>
73
+ <slot name="right"></slot>
74
+ </view>
75
+ </view>
76
+ </template>
77
+
78
+ <script>
79
+ import { defineComponent } from 'vue';
80
+
81
+ /**
82
+ * Easyinput 输入框
83
+ * @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
84
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=3455
85
+ * @property {String} value 输入内容
86
+ * @property {String } type 输入框的类型(默认text) password/text/textarea/..
87
+ * @value text 文本输入键盘
88
+ * @value textarea 多行文本输入键盘
89
+ * @value password 密码输入键盘
90
+ * @value number 数字输入键盘,注意iOS上app-vue弹出的数字键盘并非9宫格方式
91
+ * @value idcard 身份证输入键盘,信、支付宝、百度、QQ小程序
92
+ * @value digit 带小数点的数字键盘 ,App的nvue页面、微信、支付宝、百度、头条、QQ小程序支持
93
+ * @property {Boolean} clearable 是否显示右侧清空内容的图标控件,点击可清空输入框内容(默认true)
94
+ * @property {Boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认true)
95
+ * @property {String } placeholder 输入框的提示文字
96
+ * @property {String } placeholderStyle placeholder的样式(内联样式,字符串),如"color: #ddd"
97
+ * @property {Boolean} focus 是否自动获得焦点(默认false)
98
+ * @property {Boolean} disabled 是否禁用(默认false)
99
+ * @property {Number } maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认140)
100
+ * @property {String } confirmType 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done)
101
+ * @property {Number } clearSize 清除图标的大小,单位px(默认15)
102
+ * @property {String} prefixIcon 输入框头部图标
103
+ * @property {String} suffixIcon 输入框尾部图标
104
+ * @property {String} primaryColor 设置主题色(默认#2979ff)
105
+ * @property {Boolean} trim 是否自动去除两端的空格
106
+ * @property {Boolean} cursorSpacing 指定光标与键盘的距离,单位 px
107
+ * @value both 去除两端空格
108
+ * @value left 去除左侧空格
109
+ * @value right 去除右侧空格
110
+ * @value start 去除左侧空格
111
+ * @value end 去除右侧空格
112
+ * @value all 去除全部空格
113
+ * @value none 不去除空格
114
+ * @property {Boolean} inputBorder 是否显示input输入框的边框(默认true)
115
+ * @property {Boolean} passwordIcon type=password时是否显示小眼睛图标
116
+ * @property {Object} styles 自定义颜色
117
+ * @event {Function} input 输入框内容发生变化时触发
118
+ * @event {Function} focus 输入框获得焦点时触发
119
+ * @event {Function} blur 输入框失去焦点时触发
120
+ * @event {Function} confirm 点击完成按钮时触发
121
+ * @event {Function} iconClick 点击图标时触发
122
+ * @example <uni-easyinput v-model="mobile"></uni-easyinput>
123
+ */
124
+ function obj2strClass(obj) {
125
+ let classess = '';
126
+ for (let key in obj) {
127
+ const val = obj[key];
128
+ if (val) {
129
+ classess += `${key} `;
130
+ }
131
+ }
132
+ return classess;
133
+ }
134
+
135
+ function obj2strStyle(obj) {
136
+ let style = '';
137
+ for (let key in obj) {
138
+ const val = obj[key];
139
+ style += `${key}:${val};`;
140
+ }
141
+ return style;
142
+ }
143
+
144
+ export default defineComponent({
145
+ name: 'UniEasyinput',
146
+ emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change', 'keyboardheightchange'],
147
+ model: {
148
+ prop: 'modelValue',
149
+ event: 'update:modelValue',
150
+ },
151
+ options: {
152
+ virtualHost: true,
153
+ },
154
+ inject: {
155
+ form: {
156
+ from: 'uniForm',
157
+ default: null,
158
+ },
159
+ formItem: {
160
+ from: 'uniFormItem',
161
+ default: null,
162
+ },
163
+ },
164
+ props: {
165
+ name: String,
166
+ value: [Number, String],
167
+ modelValue: [Number, String],
168
+ type: {
169
+ type: String,
170
+ default: 'text',
171
+ },
172
+ clearable: {
173
+ type: Boolean,
174
+ default: true,
175
+ },
176
+ autoHeight: {
177
+ type: Boolean,
178
+ default: false,
179
+ },
180
+ placeholder: {
181
+ type: String,
182
+ default: ' ',
183
+ },
184
+ placeholderStyle: String,
185
+ focus: {
186
+ type: Boolean,
187
+ default: false,
188
+ },
189
+ disabled: {
190
+ type: Boolean,
191
+ default: false,
192
+ },
193
+ maxlength: {
194
+ type: [Number, String],
195
+ default: 140,
196
+ },
197
+ confirmType: {
198
+ type: String,
199
+ default: 'done',
200
+ },
201
+ clearSize: {
202
+ type: [Number, String],
203
+ default: 24,
204
+ },
205
+ inputBorder: {
206
+ type: Boolean,
207
+ default: true,
208
+ },
209
+ prefixIcon: {
210
+ type: String,
211
+ default: '',
212
+ },
213
+ suffixIcon: {
214
+ type: String,
215
+ default: '',
216
+ },
217
+ trim: {
218
+ type: [Boolean, String],
219
+ default: false,
220
+ },
221
+ cursorSpacing: {
222
+ type: Number,
223
+ default: 0,
224
+ },
225
+ passwordIcon: {
226
+ type: Boolean,
227
+ default: true,
228
+ },
229
+ primaryColor: {
230
+ type: String,
231
+ default: '#2979ff',
232
+ },
233
+ styles: {
234
+ type: Object,
235
+ default() {
236
+ return {
237
+ color: '#333',
238
+ backgroundColor: '#fff',
239
+ disableColor: '#F7F6F6',
240
+ borderColor: '#e5e5e5',
241
+ };
242
+ },
243
+ },
244
+ errorMessage: {
245
+ type: [String, Boolean],
246
+ default: '',
247
+ },
248
+ },
249
+ data() {
250
+ return {
251
+ focused: false,
252
+ val: '',
253
+ showMsg: '',
254
+ border: false,
255
+ isFirstBorder: false,
256
+ showClearIcon: false,
257
+ showPassword: false,
258
+ focusShow: false,
259
+ localMsg: '',
260
+ isEnter: false, // 用于判断当前是否是使用回车操作
261
+ };
262
+ },
263
+ computed: {
264
+ // 输入框内是否有值
265
+ isVal() {
266
+ const val = this.val;
267
+ // fixed by mehaotian 处理值为0的情况,字符串0不在处理范围
268
+ if (val || val === 0) {
269
+ return true;
270
+ }
271
+ return false;
272
+ },
273
+
274
+ msg() {
275
+ // console.log('computed', this.form, this.formItem);
276
+ // if (this.form) {
277
+ // return this.errorMessage || this.formItem.errMsg;
278
+ // }
279
+ // TODO 处理头条 formItem 中 errMsg 不更新的问题
280
+ return this.localMsg || this.errorMessage;
281
+ },
282
+ // 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
283
+ inputMaxlength() {
284
+ return Number(this.maxlength);
285
+ },
286
+
287
+ // 处理外层样式的style
288
+ boxStyle() {
289
+ return `color:${this.inputBorder && this.msg ? '#e43d33' : this.styles.color};`;
290
+ },
291
+ // input 内容的类和样式处理
292
+ inputContentClass() {
293
+ return obj2strClass({
294
+ 'is-input-border': this.inputBorder,
295
+ 'is-input-error-border': this.inputBorder && this.msg,
296
+ 'is-textarea': this.type === 'textarea',
297
+ 'is-disabled': this.disabled,
298
+ 'is-focused': this.focusShow,
299
+ });
300
+ },
301
+ inputContentStyle() {
302
+ const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
303
+ const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor;
304
+ return obj2strStyle({
305
+ 'border-color': borderColor || '#e5e5e5',
306
+ 'background-color': this.disabled ? this.styles.disableColor : this.styles.backgroundColor,
307
+ });
308
+ },
309
+ // input右侧样式
310
+ inputStyle() {
311
+ const paddingRight = this.type === 'password' || this.clearable || this.prefixIcon ? '' : '10px';
312
+ return obj2strStyle({
313
+ 'padding-right': paddingRight,
314
+ 'padding-left': this.prefixIcon ? '' : '10px',
315
+ });
316
+ },
317
+ },
318
+ watch: {
319
+ value(newVal) {
320
+ this.val = newVal;
321
+ },
322
+ modelValue(newVal) {
323
+ this.val = newVal;
324
+ },
325
+ focus(newVal) {
326
+ this.$nextTick(() => {
327
+ this.focused = this.focus;
328
+ this.focusShow = this.focus;
329
+ });
330
+ },
331
+ },
332
+ created() {
333
+ this.init();
334
+ // TODO 处理头条vue3 computed 不监听 inject 更改的问题(formItem.errMsg)
335
+ if (this.form && this.formItem) {
336
+ this.$watch('formItem.errMsg', (newVal) => {
337
+ this.localMsg = newVal;
338
+ });
339
+ }
340
+ },
341
+ mounted() {
342
+ this.$nextTick(() => {
343
+ this.focused = this.focus;
344
+ this.focusShow = this.focus;
345
+ });
346
+ },
347
+ methods: {
348
+ /**
349
+ * 初始化变量值
350
+ */
351
+ init() {
352
+ if (this.value || this.value === 0) {
353
+ this.val = this.value;
354
+ } else if (this.modelValue || this.modelValue === 0 || this.modelValue === '') {
355
+ this.val = this.modelValue;
356
+ } else {
357
+ this.val = null;
358
+ }
359
+ },
360
+
361
+ /**
362
+ * 点击图标时触发
363
+ * @param {Object} type
364
+ */
365
+ onClickIcon(type) {
366
+ this.$emit('iconClick', type);
367
+ },
368
+
369
+ /**
370
+ * 显示隐藏内容,密码框时生效
371
+ */
372
+ onEyes() {
373
+ this.showPassword = !this.showPassword;
374
+ this.$emit('eyes', this.showPassword);
375
+ },
376
+
377
+ /**
378
+ * 输入时触发
379
+ * @param {Object} event
380
+ */
381
+ onInput(event) {
382
+ let value = event.detail.value;
383
+ // 判断是否去除空格
384
+ if (this.trim) {
385
+ if (typeof this.trim === 'boolean' && this.trim) {
386
+ value = this.trimStr(value);
387
+ }
388
+ if (typeof this.trim === 'string') {
389
+ value = this.trimStr(value, this.trim);
390
+ }
391
+ }
392
+ if (this.errMsg) this.errMsg = '';
393
+ this.val = value;
394
+ // TODO 兼容 vue2
395
+ this.$emit('input', value);
396
+ // TODO 兼容 vue3
397
+ this.$emit('update:modelValue', value);
398
+ },
399
+
400
+ /**
401
+ * 外部调用方法
402
+ * 获取焦点时触发
403
+ * @param {Object} event
404
+ */
405
+ onFocus() {
406
+ this.$nextTick(() => {
407
+ this.focused = true;
408
+ });
409
+ this.$emit('focus', null);
410
+ },
411
+
412
+ _Focus(event) {
413
+ this.focusShow = true;
414
+ this.$emit('focus', event);
415
+ },
416
+
417
+ /**
418
+ * 外部调用方法
419
+ * 失去焦点时触发
420
+ * @param {Object} event
421
+ */
422
+ onBlur() {
423
+ this.focused = false;
424
+ this.$emit('focus', null);
425
+ },
426
+ _Blur(event) {
427
+ let value = event.detail.value;
428
+ this.focusShow = false;
429
+ this.$emit('blur', event);
430
+ // 根据类型返回值,在event中获取的值理论上讲都是string
431
+ if (this.isEnter === false) {
432
+ this.$emit('change', this.val);
433
+ }
434
+ // 失去焦点时参与表单校验
435
+ if (this.form && this.formItem) {
436
+ const { validateTrigger } = this.form;
437
+ if (validateTrigger === 'blur') {
438
+ this.formItem.onFieldChange();
439
+ }
440
+ }
441
+ },
442
+
443
+ /**
444
+ * 按下键盘的发送键
445
+ * @param {Object} e
446
+ */
447
+ onConfirm(e) {
448
+ this.$emit('confirm', this.val);
449
+ this.isEnter = true;
450
+ this.$emit('change', this.val);
451
+ this.$nextTick(() => {
452
+ this.isEnter = false;
453
+ });
454
+ },
455
+
456
+ /**
457
+ * 清理内容
458
+ * @param {Object} event
459
+ */
460
+ onClear(event) {
461
+ this.val = '';
462
+ // TODO 兼容 vue2
463
+ this.$emit('input', '');
464
+ // TODO 兼容 vue2
465
+ // TODO 兼容 vue3
466
+ this.$emit('update:modelValue', '');
467
+ // 点击叉号触发
468
+ this.$emit('clear');
469
+ },
470
+
471
+ /**
472
+ * 键盘高度发生变化的时候触发此事件
473
+ * 兼容性:微信小程序2.7.0+、App 3.1.0+
474
+ * @param {Object} event
475
+ */
476
+ onkeyboardheightchange(event) {
477
+ this.$emit('keyboardheightchange', event);
478
+ },
479
+
480
+ /**
481
+ * 去除空格
482
+ */
483
+ trimStr(str, pos = 'both') {
484
+ if (pos === 'both') {
485
+ return str.trim();
486
+ } else if (pos === 'left') {
487
+ return str.trimLeft();
488
+ } else if (pos === 'right') {
489
+ return str.trimRight();
490
+ } else if (pos === 'start') {
491
+ return str.trimStart();
492
+ } else if (pos === 'end') {
493
+ return str.trimEnd();
494
+ } else if (pos === 'all') {
495
+ return str.replace(/\s+/g, '');
496
+ } else if (pos === 'none') {
497
+ return str;
498
+ }
499
+ return str;
500
+ },
501
+ },
502
+ });
503
+ </script>
504
+
505
+ <style lang="scss">
506
+ $uni-error: #e43d33;
507
+ $uni-border-1: #dcdfe6 !default;
508
+
509
+ .uni-easyinput {
510
+ /* #ifndef APP-NVUE */
511
+ width: 100%;
512
+ /* #endif */
513
+ flex: 1;
514
+ position: relative;
515
+ text-align: left;
516
+ color: #333;
517
+ font-size: 14px;
518
+ }
519
+
520
+ .uni-easyinput__content {
521
+ flex: 1;
522
+ /* #ifndef APP-NVUE */
523
+ width: 100%;
524
+ display: flex;
525
+ box-sizing: border-box;
526
+ // min-height: 36px;
527
+ /* #endif */
528
+ flex-direction: row;
529
+ align-items: center;
530
+ // 处理border动画刚开始显示黑色的问题
531
+ border-color: #fff;
532
+ transition-property: border-color;
533
+ transition-duration: 0.3s;
534
+ }
535
+
536
+ .uni-easyinput__content-input {
537
+ /* #ifndef APP-NVUE */
538
+ width: auto;
539
+ /* #endif */
540
+ position: relative;
541
+ overflow: hidden;
542
+ flex: 1;
543
+ line-height: 1;
544
+ font-size: 14px;
545
+ height: 35px;
546
+ // min-height: 36px;
547
+ }
548
+
549
+ .uni-easyinput__placeholder-class {
550
+ color: #999;
551
+ font-size: 12px;
552
+ // font-weight: 200;
553
+ }
554
+
555
+ .is-textarea {
556
+ align-items: flex-start;
557
+ }
558
+
559
+ .is-textarea-icon {
560
+ margin-top: 5px;
561
+ }
562
+
563
+ .uni-easyinput__content-textarea {
564
+ position: relative;
565
+ overflow: hidden;
566
+ flex: 1;
567
+ line-height: 1.5;
568
+ font-size: 14px;
569
+ margin: 6px;
570
+ margin-left: 0;
571
+ height: 80px;
572
+ min-height: 80px;
573
+ /* #ifndef APP-NVUE */
574
+ min-height: 80px;
575
+ width: auto;
576
+ /* #endif */
577
+ }
578
+
579
+ .input-padding {
580
+ padding-left: 10px;
581
+ }
582
+
583
+ .content-clear-icon {
584
+ padding: 0 5px;
585
+ }
586
+
587
+ .label-icon {
588
+ margin-right: 5px;
589
+ margin-top: -1px;
590
+ }
591
+
592
+ // 显示边框
593
+ .is-input-border {
594
+ /* #ifndef APP-NVUE */
595
+ display: flex;
596
+ box-sizing: border-box;
597
+ /* #endif */
598
+ flex-direction: row;
599
+ align-items: center;
600
+ border: 1px solid $uni-border-1;
601
+ border-radius: 4px;
602
+ /* #ifdef MP-ALIPAY */
603
+ overflow: hidden;
604
+ /* #endif */
605
+ }
606
+
607
+ .uni-error-message {
608
+ position: absolute;
609
+ bottom: -17px;
610
+ left: 0;
611
+ line-height: 12px;
612
+ color: $uni-error;
613
+ font-size: 12px;
614
+ text-align: left;
615
+ }
616
+
617
+ .uni-error-msg--boeder {
618
+ position: relative;
619
+ bottom: 0;
620
+ line-height: 22px;
621
+ }
622
+
623
+ .is-input-error-border {
624
+ border-color: $uni-error;
625
+
626
+ .uni-easyinput__placeholder-class {
627
+ color: mix(#fff, $uni-error, 50%);
628
+ }
629
+ }
630
+
631
+ .uni-easyinput--border {
632
+ margin-bottom: 0;
633
+ padding: 10px 15px;
634
+ // padding-bottom: 0;
635
+ border-top: 1px #eee solid;
636
+ }
637
+
638
+ .uni-easyinput-error {
639
+ padding-bottom: 0;
640
+ }
641
+
642
+ .is-first-border {
643
+ /* #ifndef APP-NVUE */
644
+ border: none;
645
+ /* #endif */
646
+ /* #ifdef APP-NVUE */
647
+ border-width: 0;
648
+ /* #endif */
649
+ }
650
+
651
+ .is-disabled {
652
+ background-color: #f7f6f6;
653
+ color: #d5d5d5;
654
+
655
+ .uni-easyinput__placeholder-class {
656
+ color: #d5d5d5;
657
+ font-size: 12px;
658
+ }
659
+ }
660
+ </style>