uview-plus 3.8.55 → 3.8.106

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 (229) hide show
  1. package/changelog.md +2147 -1828
  2. package/components/u-action-sheet/props.js +3 -1
  3. package/components/u-action-sheet/u-action-sheet.vue +22 -2
  4. package/components/u-album/props.js +3 -1
  5. package/components/u-alert/props.js +4 -2
  6. package/components/u-avatar/props.js +4 -1
  7. package/components/u-avatar-group/props.js +4 -1
  8. package/components/u-back-top/props.js +4 -1
  9. package/components/u-badge/props.js +4 -1
  10. package/components/u-barcode/u-barcode.vue +44 -15
  11. package/components/u-box/props.js +5 -2
  12. package/components/u-button/props.js +4 -1
  13. package/components/u-button/u-button.vue +2 -5
  14. package/components/u-button/vue.scss +3 -3
  15. package/components/u-calendar/calendar.js +8 -0
  16. package/components/u-calendar/props.js +43 -1
  17. package/components/u-calendar/u-calendar.vue +16 -0
  18. package/components/u-calendar-strip/props.js +3 -1
  19. package/components/u-canvas/u-canvas.vue +1028 -423
  20. package/components/u-car-keyboard/props.js +3 -1
  21. package/components/u-card/props.js +3 -1
  22. package/components/u-cell/props.js +4 -1
  23. package/components/u-cell/u-cell.vue +9 -1
  24. package/components/u-cell-group/props.js +4 -1
  25. package/components/u-checkbox/props.js +4 -1
  26. package/components/u-checkbox/u-checkbox.vue +7 -3
  27. package/components/u-checkbox-group/props.js +3 -1
  28. package/components/u-circle-progress/props.js +4 -1
  29. package/components/u-code/props.js +4 -1
  30. package/components/u-code-input/props.js +4 -1
  31. package/components/u-col/props.js +4 -1
  32. package/components/u-collapse/props.js +4 -1
  33. package/components/u-collapse-item/props.js +4 -1
  34. package/components/u-color-picker/u-color-picker.vue +1 -0
  35. package/components/u-column-notice/props.js +4 -1
  36. package/components/u-count-down/props.js +4 -1
  37. package/components/u-count-to/props.js +4 -1
  38. package/components/u-cropper/u-cropper.vue +95 -51
  39. package/components/u-datetime-picker/props.js +4 -1
  40. package/components/u-datetime-picker/u-datetime-picker.vue +53 -4
  41. package/components/u-divider/props.js +4 -1
  42. package/components/u-dragsort/u-dragsort.vue +57 -32
  43. package/components/u-dropdown/props.js +3 -1
  44. package/components/u-dropdown-item/props.js +3 -1
  45. package/components/u-empty/props.js +4 -1
  46. package/components/u-form/props.js +4 -1
  47. package/components/u-form-item/props.js +4 -1
  48. package/components/u-gap/props.js +4 -1
  49. package/components/u-grid/props.js +4 -1
  50. package/components/u-grid-item/props.js +4 -1
  51. package/components/u-guide/props.js +3 -1
  52. package/components/u-icon/props.js +4 -1
  53. package/components/u-icon/u-icon.vue +11 -2
  54. package/components/u-icon/upicon.ttf +0 -0
  55. package/components/u-icon/util.js +103 -10
  56. package/components/u-image/props.js +4 -1
  57. package/components/u-image/u-image.vue +280 -267
  58. package/components/u-index-anchor/props.js +4 -1
  59. package/components/u-index-item/props.js +2 -1
  60. package/components/u-index-item/u-index-item.vue +1 -1
  61. package/components/u-index-list/props.js +4 -1
  62. package/components/u-index-list/u-index-list.vue +1 -1
  63. package/components/u-input/props.js +3 -1
  64. package/components/u-keyboard/props.js +4 -1
  65. package/components/u-line/props.js +4 -1
  66. package/components/u-line-progress/props.js +6 -3
  67. package/components/u-link/props.js +4 -1
  68. package/components/u-list/props.js +4 -1
  69. package/components/u-list-item/props.js +4 -1
  70. package/components/u-loading-icon/props.js +4 -1
  71. package/components/u-loading-page/props.js +3 -1
  72. package/components/u-loadmore/props.js +4 -1
  73. package/components/u-markdown/u-markdown.vue +45 -3
  74. package/components/u-modal/props.js +4 -1
  75. package/components/u-navbar/props.js +4 -2
  76. package/components/u-navbar/u-navbar.vue +15 -9
  77. package/components/u-no-network/props.js +4 -1
  78. package/components/u-notice-bar/props.js +4 -1
  79. package/components/u-notify/props.js +4 -1
  80. package/components/u-novel-reader/content-normalizer.js +80 -0
  81. package/components/u-novel-reader/layout-engine.js +225 -0
  82. package/components/u-novel-reader/measure-adapter.js +69 -0
  83. package/components/u-novel-reader/novelReader.js +35 -0
  84. package/components/u-novel-reader/persistence.js +144 -0
  85. package/components/u-novel-reader/props.js +100 -0
  86. package/components/u-novel-reader/reader-catalog.vue +234 -0
  87. package/components/u-novel-reader/reader-content.vue +226 -0
  88. package/components/u-novel-reader/reader-core.js +151 -0
  89. package/components/u-novel-reader/reader-settings.vue +325 -0
  90. package/components/u-novel-reader/reader-toolbar.vue +313 -0
  91. package/components/u-novel-reader/theme-vars.scss +49 -0
  92. package/components/u-novel-reader/u-novel-reader.vue +836 -0
  93. package/components/u-number-box/props.js +4 -1
  94. package/components/u-number-box/u-number-box.vue +2 -2
  95. package/components/u-number-keyboard/props.js +4 -1
  96. package/components/u-overlay/props.js +4 -1
  97. package/components/u-pagination/u-pagination.vue +60 -39
  98. package/components/u-parse/props.js +4 -1
  99. package/components/u-picker/props.js +4 -1
  100. package/components/u-picker-column/props.js +3 -1
  101. package/components/u-popover/props.js +2 -1
  102. package/components/u-popup/props.js +4 -1
  103. package/components/u-poster/u-poster.vue +246 -214
  104. package/components/u-qrcode/qrcode.js +105 -97
  105. package/components/u-qrcode/u-qrcode.vue +242 -289
  106. package/components/u-radio/props.js +4 -1
  107. package/components/u-radio/u-radio.vue +7 -3
  108. package/components/u-radio-group/props.js +4 -1
  109. package/components/u-rate/props.js +4 -1
  110. package/components/u-read-more/props.js +4 -1
  111. package/components/u-row/props.js +4 -1
  112. package/components/u-row-notice/props.js +4 -1
  113. package/components/u-safe-bottom/props.js +2 -1
  114. package/components/u-scroll-list/props.js +4 -1
  115. package/components/u-scroll-list/scrollWxs.wxs +1 -1
  116. package/components/u-search/props.js +3 -1
  117. package/components/u-skeleton/props.js +4 -1
  118. package/components/u-slider/props.js +3 -1
  119. package/components/u-slider/u-slider.vue +71 -29
  120. package/components/u-status-bar/props.js +4 -1
  121. package/components/u-steps/props.js +4 -1
  122. package/components/u-steps-item/props.js +4 -1
  123. package/components/u-sticky/props.js +4 -1
  124. package/components/u-sticky/u-sticky.vue +11 -0
  125. package/components/u-subsection/props.js +3 -1
  126. package/components/u-swipe-action/props.js +4 -1
  127. package/components/u-swipe-action-item/index.wxs +43 -25
  128. package/components/u-swipe-action-item/nvue.js +9 -0
  129. package/components/u-swipe-action-item/other.js +32 -21
  130. package/components/u-swipe-action-item/props.js +9 -1
  131. package/components/u-swipe-action-item/swipeActionItem.js +1 -0
  132. package/components/u-swipe-action-item/u-swipe-action-item.vue +42 -4
  133. package/components/u-swiper/props.js +9 -1
  134. package/components/u-swiper/swiper.js +1 -0
  135. package/components/u-swiper/u-swiper.vue +2 -0
  136. package/components/u-swiper-indicator/props.js +4 -1
  137. package/components/u-switch/props.js +4 -1
  138. package/components/u-switch/u-switch.vue +1 -1
  139. package/components/u-tabbar/props.js +3 -1
  140. package/components/u-tabbar/u-tabbar.vue +2 -1
  141. package/components/u-tabbar-item/props.js +4 -1
  142. package/components/u-tabbar-item/u-tabbar-item.vue +64 -21
  143. package/components/u-table/props.js +3 -1
  144. package/components/u-table2/tableRow.vue +155 -69
  145. package/components/u-table2/u-table2.vue +327 -137
  146. package/components/u-tabs/props.js +4 -1
  147. package/components/u-tabs/u-tabs.vue +11 -8
  148. package/components/u-tabs-item/props.js +3 -1
  149. package/components/u-tabs-pro/u-tabs-pro.vue +212 -0
  150. package/components/u-tag/props.js +4 -1
  151. package/components/u-td/props.js +3 -1
  152. package/components/u-text/props.js +4 -1
  153. package/components/u-text/text.js +1 -1
  154. package/components/u-text/u-text.vue +18 -6
  155. package/components/u-textarea/props.js +3 -1
  156. package/components/u-textarea/u-textarea.vue +16 -5
  157. package/components/u-th/props.js +3 -1
  158. package/components/u-toolbar/props.js +4 -1
  159. package/components/u-tooltip/props.js +10 -2
  160. package/components/u-tooltip/tooltip.js +2 -1
  161. package/components/u-tooltip/u-tooltip.vue +31 -3
  162. package/components/u-tr/props.js +3 -1
  163. package/components/u-transition/nvue-ani-map.js +75 -68
  164. package/components/u-transition/props.js +4 -1
  165. package/components/u-transition/transitionMixin.js +164 -163
  166. package/components/u-upload/props.js +4 -1
  167. package/components/u-upload/u-upload.vue +48 -41
  168. package/components/u-waterfall/u-waterfall.vue +162 -110
  169. package/index.js +65 -8
  170. package/libs/config/config.js +1 -1
  171. package/libs/config/props.js +180 -204
  172. package/libs/css/components.scss +3 -0
  173. package/libs/function/index.js +66 -0
  174. package/libs/function/uni-api-shims.js +29 -0
  175. package/libs/i18n/index.js +71 -36
  176. package/libs/i18n/locale-packs.js +11 -0
  177. package/libs/i18n/locales/all.js +23 -0
  178. package/libs/i18n/locales/{de.json → de.js} +1 -1
  179. package/libs/i18n/locales/{en.json → en.js} +2 -2
  180. package/libs/i18n/locales/{es.json → es.js} +1 -1
  181. package/libs/i18n/locales/{fr.json → fr.js} +2 -2
  182. package/libs/i18n/locales/{ja.json → ja.js} +1 -1
  183. package/libs/i18n/locales/{ko.json → ko.js} +1 -1
  184. package/libs/i18n/locales/{ru.json → ru.js} +1 -1
  185. package/libs/i18n/locales/{th.json → th.js} +1 -1
  186. package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
  187. package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
  188. package/libs/mixin/mixin.js +18 -54
  189. package/libs/root/index.js +78 -5
  190. package/libs/root/page.js +7 -7
  191. package/libs/root/root.js +73 -3
  192. package/libs/util/app-nvue-webview-canvas.js +486 -0
  193. package/libs/util/gcanvas/bridge/bridge-weex.js +10 -7
  194. package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
  195. package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
  196. package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
  197. package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
  198. package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
  199. package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
  200. package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
  201. package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
  202. package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
  203. package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
  204. package/libs/util/gcanvas/context-webgl/Program.js +0 -0
  205. package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
  206. package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
  207. package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
  208. package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
  209. package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
  210. package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
  211. package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
  212. package/libs/util/gcanvas/env/canvas.js +0 -0
  213. package/libs/util/gcanvas/env/image.js +0 -0
  214. package/libs/util/gcanvas/env/tool.js +0 -0
  215. package/libs/util/gcanvas/index.js +3 -3
  216. package/package.json +4 -5
  217. package/tsconfig.json +18 -0
  218. package/types/comps/calendar.d.ts +38 -0
  219. package/types/comps/checkbox.d.ts +12 -0
  220. package/types/comps/lineProgress.d.ts +5 -0
  221. package/types/comps/navbar.d.ts +3 -3
  222. package/types/comps/swipeActionItem.d.ts +13 -0
  223. package/types/comps/swiper.d.ts +5 -0
  224. package/types/comps/tabs.d.ts +2 -1
  225. package/types/comps/text.d.ts +1 -1
  226. package/types/comps/tooltip.d.ts +36 -1
  227. package/types/func.d.ts +23 -0
  228. package/types/index.d.ts +1 -0
  229. /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import TabsDefaultProps from './tabs'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(TabsDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 滑块的移动过渡时间,单位ms
@@ -7,7 +7,7 @@
7
7
  class="u-tabs__wrapper__scroll-view" :show-scrollbar="false" ref="u-tabs__wrapper__scroll-view">
8
8
  <view class="u-tabs__wrapper__nav" ref="u-tabs__wrapper__nav">
9
9
  <view class="u-tabs__wrapper__nav__item" v-for="(item, index) in tabList" :key="index"
10
- @tap="clickHandler(item, index)" @longpress="longPressHandler(item,index)"
10
+ @tap="clickHandler(item, index, $event)" @longpress="longPressHandler(item,index)"
11
11
  :ref="`u-tabs__wrapper__nav__item-${index}`"
12
12
  :style="[itemComputedStyle, {flex: scrollable ? '' : 1}]" :class="[`u-tabs__wrapper__nav__item-${index}`,
13
13
  shapeMode && `u-tabs__wrapper__nav__item--${shapeMode}`,
@@ -108,7 +108,7 @@
108
108
  * @property {String} keyName 从`list`元素对象中读取的键名(默认 'name' )
109
109
  * @property {String} shapeMode 标签形态模式,可选capsule/card/pill-arrow/tag(默认 '' )
110
110
  * @event {Function(index)} change 标签改变时触发 index: 点击了第几个tab,索引从0开始
111
- * @event {Function(index)} click 点击标签时触发 index: 点击了第几个tab,索引从0开始
111
+ * @event {Function(item, index, event)} click 点击标签时触发,event 为原始点击事件
112
112
  * @event {Function(index)} longPress 长按标签时触发 index: 点击了第几个tab,索引从0开始
113
113
  * @example <u-tabs :list="list" :is-scroll="false" :current="current" @change="change" @longPress="longPress"></u-tabs>
114
114
  */
@@ -195,10 +195,13 @@
195
195
  const isActive = index == this.innerCurrent
196
196
  const defaultActiveColor = defProps.tabs?.activeStyle?.color || '#303133'
197
197
  const defaultInactiveColor = defProps.tabs?.inactiveStyle?.color || '#606266'
198
- const isActiveStyleOverridden = this.upHasProp('activeStyle')
199
- || (customeStyle && customeStyle.color && customeStyle.color !== defaultActiveColor)
200
- const isInactiveStyleOverridden = this.upHasProp('inactiveStyle')
201
- || (customeStyle && customeStyle.color && customeStyle.color !== defaultInactiveColor)
198
+ const hasCustomColor = customeStyle
199
+ && Object.prototype.hasOwnProperty.call(customeStyle, 'color')
200
+ && String(customeStyle.color ?? '').trim() !== ''
201
+ const isActiveStyleOverridden = hasCustomColor && (this.upHasProp('activeStyle')
202
+ || customeStyle.color !== defaultActiveColor)
203
+ const isInactiveStyleOverridden = hasCustomColor && (this.upHasProp('inactiveStyle')
204
+ || customeStyle.color !== defaultInactiveColor)
202
205
  if (isActive && ['pill-arrow', 'tag'].includes(this.shapeMode) && !isActiveStyleOverridden) {
203
206
  style.color = '#ffffff'
204
207
  } else if (isActive && !isActiveStyleOverridden) {
@@ -267,12 +270,12 @@
267
270
  // #endif
268
271
  },
269
272
  // 点击某一个标签
270
- clickHandler(item, index) {
273
+ clickHandler(item, index, event) {
271
274
  // 因为标签可能为disabled状态,所以click是一定会发出的,但是change事件是需要可用的状态才发出
272
275
  this.$emit('click', {
273
276
  ...item,
274
277
  index
275
- }, index)
278
+ }, index, event)
276
279
  // 如果disabled状态,返回
277
280
  if (item.disabled) return
278
281
  // 如果点击当前不触发change
@@ -1,5 +1,7 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import { registerComponentProps } from '../../libs/config/props.js'
3
+
4
+ const defProps = registerComponentProps({ tabsItem: {} })
3
5
  export const props = defineMixin({
4
6
  props: {
5
7
 
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <view class="u-tabs-pro" :class="customClass" :style="customStyle">
3
+ <up-tabs
4
+ :list="safeList"
5
+ :keyName="keyName"
6
+ :current="innerCurrent"
7
+ :lineColor="resolvedLineColor"
8
+ :activeStyle="activeStyle"
9
+ :inactiveStyle="inactiveStyle"
10
+ :lineWidth="lineWidth"
11
+ :lineHeight="lineHeight"
12
+ :lineBgSize="lineBgSize"
13
+ :itemStyle="itemStyle"
14
+ :scrollable="scrollable"
15
+ :duration="Number(duration)"
16
+ :iconStyle="iconStyle"
17
+ :shapeMode="shapeMode"
18
+ @update:current="updateCurrent"
19
+ @click="clickHandler"
20
+ @longPress="longPressHandler"
21
+ @change="changeHandler"
22
+ >
23
+ <template v-if="$slots.left" #left>
24
+ <slot name="left" />
25
+ </template>
26
+ <template v-if="$slots.icon" #icon="scope">
27
+ <slot name="icon" :item="scope.item" :keyName="scope.keyName" :index="scope.index" />
28
+ </template>
29
+ <template v-if="$slots.tab || $slots.content" #content="scope">
30
+ <slot name="tab" :item="scope.item" :keyName="scope.keyName" :index="scope.index">
31
+ <slot name="content" :item="scope.item" :keyName="scope.keyName" :index="scope.index" />
32
+ </slot>
33
+ </template>
34
+ <template v-if="$slots.right" #right>
35
+ <slot name="right" />
36
+ </template>
37
+ </up-tabs>
38
+ <view
39
+ v-if="showContent"
40
+ class="u-tabs-pro__content"
41
+ :class="contentClass"
42
+ :style="contentStyle"
43
+ >
44
+ <slot
45
+ :current="innerCurrent"
46
+ :index="innerCurrent"
47
+ :item="currentItem"
48
+ :value="currentValue"
49
+ :list="safeList"
50
+ />
51
+ </view>
52
+ </view>
53
+ </template>
54
+
55
+ <script>
56
+ import { mpMixin } from '../../libs/mixin/mpMixin'
57
+ import { mixin } from '../../libs/mixin/mixin'
58
+
59
+ export default {
60
+ name: 'u-tabs-pro',
61
+ mixins: [mpMixin, mixin],
62
+ props: {
63
+ list: {
64
+ type: Array,
65
+ default: () => []
66
+ },
67
+ keyName: {
68
+ type: String,
69
+ default: 'name'
70
+ },
71
+ current: {
72
+ type: [Number, String],
73
+ default: 0
74
+ },
75
+ contentMode: {
76
+ type: String,
77
+ default: 'static'
78
+ },
79
+ lineColor: {
80
+ type: String,
81
+ default: ''
82
+ },
83
+ activeStyle: {
84
+ type: [String, Object],
85
+ default: () => ({})
86
+ },
87
+ inactiveStyle: {
88
+ type: [String, Object],
89
+ default: () => ({})
90
+ },
91
+ lineWidth: {
92
+ type: [String, Number],
93
+ default: 20
94
+ },
95
+ lineHeight: {
96
+ type: [String, Number],
97
+ default: 3
98
+ },
99
+ lineBgSize: {
100
+ type: String,
101
+ default: 'cover'
102
+ },
103
+ itemStyle: {
104
+ type: [String, Object],
105
+ default: () => ({ height: '44px' })
106
+ },
107
+ scrollable: {
108
+ type: Boolean,
109
+ default: true
110
+ },
111
+ duration: {
112
+ type: [Number, String],
113
+ default: 300
114
+ },
115
+ iconStyle: {
116
+ type: [String, Object],
117
+ default: () => ({})
118
+ },
119
+ shapeMode: {
120
+ type: String,
121
+ default: ''
122
+ },
123
+ showContent: {
124
+ type: Boolean,
125
+ default: true
126
+ },
127
+ contentClass: {
128
+ type: String,
129
+ default: ''
130
+ },
131
+ contentStyle: {
132
+ type: [String, Object, Array],
133
+ default: ''
134
+ },
135
+ bindIndexRef: {
136
+ type: String,
137
+ default: ''
138
+ }
139
+ },
140
+ emits: ['click', 'longPress', 'change', 'update:current'],
141
+ data() {
142
+ return {
143
+ innerCurrent: 0
144
+ }
145
+ },
146
+ computed: {
147
+ safeList() {
148
+ return Array.isArray(this.list) ? this.list : []
149
+ },
150
+ currentItem() {
151
+ return this.safeList[this.innerCurrent] || null
152
+ },
153
+ currentValue() {
154
+ return this.currentItem ? this.currentItem[this.keyName] : undefined
155
+ },
156
+ resolvedLineColor() {
157
+ return this.lineColor || undefined
158
+ }
159
+ },
160
+ watch: {
161
+ current: {
162
+ immediate: true,
163
+ handler(value) {
164
+ this.innerCurrent = this.normalizeCurrent(value)
165
+ }
166
+ },
167
+ list: {
168
+ deep: true,
169
+ handler() {
170
+ const nextCurrent = this.normalizeCurrent(this.innerCurrent)
171
+ if (nextCurrent !== this.innerCurrent) {
172
+ this.innerCurrent = nextCurrent
173
+ this.$emit('update:current', nextCurrent)
174
+ }
175
+ }
176
+ }
177
+ },
178
+ methods: {
179
+ normalizeCurrent(value) {
180
+ const parsed = Number(value)
181
+ const nextValue = Number.isFinite(parsed) ? parsed : 0
182
+ const maxIndex = Math.max(this.safeList.length - 1, 0)
183
+ return Math.min(Math.max(nextValue, 0), maxIndex)
184
+ },
185
+ updateCurrent(value) {
186
+ const nextCurrent = this.normalizeCurrent(value)
187
+ this.innerCurrent = nextCurrent
188
+ this.$emit('update:current', nextCurrent)
189
+ },
190
+ clickHandler(item, index, event) {
191
+ this.$emit('click', item, index, event)
192
+ },
193
+ longPressHandler(item, index) {
194
+ this.$emit('longPress', item, index)
195
+ },
196
+ changeHandler(item, index) {
197
+ this.updateCurrent(index)
198
+ this.$emit('change', item, index)
199
+ }
200
+ }
201
+ }
202
+ </script>
203
+
204
+ <style lang="scss" scoped>
205
+ .u-tabs-pro {
206
+ width: 100%;
207
+
208
+ &__content {
209
+ width: 100%;
210
+ }
211
+ }
212
+ </style>
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import TagDefaultProps from './tag'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(TagDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 标签类型info、primary、success、warning、error
@@ -1,5 +1,7 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import { registerComponentProps } from '../../libs/config/props.js'
3
+
4
+ const defProps = registerComponentProps({ td: {} })
3
5
  export const props = defineMixin({
4
6
  props: {
5
7
 
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import TextDefaultProps from './text'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(TextDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 主题颜色
@@ -33,7 +33,7 @@ export default {
33
33
  lineHeight: '',
34
34
  align: 'left',
35
35
  wordWrap: 'normal',
36
- flex1: true
36
+ flex1: false
37
37
  }
38
38
 
39
39
  }
@@ -73,10 +73,22 @@ import value from './value.js'
73
73
  import { mpMixin } from '../../libs/mixin/mpMixin';
74
74
  import { mixin } from '../../libs/mixin/mixin';
75
75
  import { buttonMixin } from '../../libs/mixin/button';
76
- import { openType } from '../../libs/mixin/openType';
77
- import { addStyle, addUnit, deepMerge } from '../../libs/function/index';
78
- /**
79
- * Text 文本
76
+ import { openType } from '../../libs/mixin/openType';
77
+ import { addStyle, addUnit, deepMerge } from '../../libs/function/index';
78
+
79
+ function normalizeLineHeight(value) {
80
+ const valueString = String(value).trim()
81
+ const numericValue = Number(valueString)
82
+ const isUnitless =
83
+ /^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(valueString) &&
84
+ numericValue > 0 &&
85
+ numericValue < 10
86
+
87
+ return isUnitless ? valueString : addUnit(value)
88
+ }
89
+
90
+ /**
91
+ * Text 文本
80
92
  * @description 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
81
93
  * @tutorial https://uview-plus.jiangruyi.com/components/loading.html
82
94
  * @property {String} type 主题颜色
@@ -97,7 +109,7 @@ import { addStyle, addUnit, deepMerge } from '../../libs/function/index';
97
109
  * @property {Object | String} iconStyle 图标的样式 (默认 {fontSize: '15px'} )
98
110
  * @property {String} decoration 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
99
111
  * @property {Object | String | Number} margin 外边距,对象、字符串,数值形式均可(默认 0 )
100
- * @property {String | Number} lineHeight 文本行高
112
+ * @property {String | Number} lineHeight 文本行高,支持带单位值或无单位倍数(如 1.2)
101
113
  * @property {String} align 文本对齐方式,可选值left|center|right(默认 'left' )
102
114
  * @property {String} wordWrap 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
103
115
  * @event {Function} click 点击触发事件
@@ -139,7 +151,7 @@ export default {
139
151
  }
140
152
  this.isNvue && this.lines && (style.lines = this.lines)
141
153
  this.lineHeight &&
142
- (style.lineHeight = addUnit(this.lineHeight))
154
+ (style.lineHeight = normalizeLineHeight(this.lineHeight))
143
155
  !this.isNvue && this.block && (style.display = 'block')
144
156
  return deepMerge(style, addStyle(this.customStyle))
145
157
  },
@@ -1,6 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import TextareaDefaultProps from './textarea'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
3
4
 
5
+ const defProps = registerComponentProps(TextareaDefaultProps)
4
6
  export const props = defineMixin({
5
7
  props: {
6
8
  // 输入框的内容
@@ -34,7 +34,7 @@
34
34
  class="u-textarea__count"
35
35
  :style="countStyle"
36
36
  v-if="count"
37
- >{{ innerValue.length }}/{{ maxlength }}</text
37
+ >{{ valueLength }}/{{ maxlength }}</text
38
38
  >
39
39
  <!-- #endif -->
40
40
  </view>
@@ -106,7 +106,7 @@ export default {
106
106
  value: {
107
107
  immediate: true,
108
108
  handler(newVal, oldVal) {
109
- this.innerValue = newVal;
109
+ this.innerValue = this.normalizeValue(newVal);
110
110
  /* #ifdef H5 */
111
111
  // 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
112
112
  if (
@@ -126,7 +126,7 @@ export default {
126
126
  modelValue: {
127
127
  immediate: true,
128
128
  handler(newVal, oldVal) {
129
- this.innerValue = newVal;
129
+ this.innerValue = this.normalizeValue(newVal);
130
130
  /* #ifdef H5 */
131
131
  // 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
132
132
  if (
@@ -144,6 +144,10 @@ export default {
144
144
  // #endif
145
145
  },
146
146
  computed: {
147
+ // 字数统计安全取值,避免 v-model 为 null/undefined/number 时访问 length 报错
148
+ valueLength() {
149
+ return String(this.innerValue ?? '').length
150
+ },
147
151
  placeholderStyleInner() {
148
152
  if (this.placeholderStyle) {
149
153
  return addStyle(this.placeholderStyle, typeof this.placeholderStyle === 'string' ? 'string' : 'object')
@@ -225,6 +229,12 @@ export default {
225
229
  methods: {
226
230
  addStyle,
227
231
  addUnit,
232
+ // 统一将外部值归一为可安全展示/统计的内容
233
+ normalizeValue(value) {
234
+ if (value === null || value === undefined) return ''
235
+ // textarea 展示与统计均按字符串处理
236
+ return typeof value === 'number' ? String(value) : value
237
+ },
228
238
  // 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
229
239
  setFormatter(e) {
230
240
  this.innerFormatter = e
@@ -241,10 +251,11 @@ export default {
241
251
  this.$emit("linechange", e);
242
252
  },
243
253
  onInput(e) {
244
- let { value = "" } = e.detail || {};
254
+ let { value } = e.detail || {};
255
+ value = this.normalizeValue(value)
245
256
  // 格式化过滤方法
246
257
  const formatter = this.formatter || this.innerFormatter
247
- const formatValue = formatter(value)
258
+ const formatValue = this.normalizeValue(formatter(value))
248
259
  // 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
249
260
  this.innerValue = value
250
261
  this.$nextTick(() => {
@@ -1,5 +1,7 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import { registerComponentProps } from '../../libs/config/props.js'
3
+
4
+ const defProps = registerComponentProps({ th: {} })
3
5
  export const props = defineMixin({
4
6
  props: {
5
7
 
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import ToolbarDefaultProps from './toolbar'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(ToolbarDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 是否展示工具条
@@ -1,5 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import TooltipDefaultProps from './tooltip'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
4
+
5
+ const defProps = registerComponentProps(TooltipDefaultProps)
3
6
  export const props = defineMixin({
4
7
  props: {
5
8
  // 需要显示的提示文字
@@ -76,6 +79,11 @@ export const props = defineMixin({
76
79
  show: {
77
80
  type: Boolean,
78
81
  default: () => defProps.tooltip.show
82
+ },
83
+ // 是否开启单例模式,开启该属性的tooltip同一页面同时只显示一个
84
+ singleton: {
85
+ type: Boolean,
86
+ default: () => defProps.tooltip.singleton
79
87
  }
80
88
  }
81
- })
89
+ })
@@ -24,6 +24,7 @@ export default {
24
24
  popupBgColor: '',
25
25
  triggerMode: 'longpress',
26
26
  forcePosition: {},
27
- show: false
27
+ show: false,
28
+ singleton: false
28
29
  }
29
30
  }
@@ -108,6 +108,7 @@
108
108
  // #ifdef APP-NVUE
109
109
  const dom = uni.requireNativePlugin('dom')
110
110
  // #endif
111
+ let activeSingletonTooltip = null
111
112
  /**
112
113
  * Tooltip
113
114
  * @description
@@ -123,9 +124,12 @@
123
124
  * @property {Boolean} showCopy 是否显示复制按钮(默认 true )
124
125
  * @property {Array} buttons 扩展的按钮组
125
126
  * @property {Boolean} overlay 是否显示透明遮罩以防止触摸穿透(默认 true )
127
+ * @property {Boolean} singleton 是否开启单例模式,开启该属性的tooltip同一页面同时只显示一个(默认 false )
126
128
  * @property {Object} customStyle 定义需要用到的外部样式
127
129
  *
128
- * @event {Function}
130
+ * @event {Function} open 打开时触发
131
+ * @event {Function} close 关闭时触发
132
+ * @event {Function} update:show 显示状态变化时触发
129
133
  * @example
130
134
  */
131
135
  export default {
@@ -240,7 +244,13 @@
240
244
  mounted() {
241
245
  this.init()
242
246
  },
243
- emits: ["click", "open", "close"],
247
+ beforeUnmount() {
248
+ this.clearActiveTooltip()
249
+ },
250
+ beforeDestroy() {
251
+ this.clearActiveTooltip()
252
+ },
253
+ emits: ["click", "open", "close", "update:show"],
244
254
  methods: {
245
255
  addStyle,
246
256
  addUnit,
@@ -262,15 +272,33 @@
262
272
  },
263
273
  // 打开tooltip
264
274
  open() {
275
+ if (this.singleton && activeSingletonTooltip && activeSingletonTooltip !== this) {
276
+ activeSingletonTooltip.close()
277
+ }
278
+ if (this.singleton) {
279
+ activeSingletonTooltip = this
280
+ }
281
+ if (this.showTooltip && this.tooltipTop === 0) return
265
282
  this.tooltipTop = 0
266
283
  this.showTooltip = true
284
+ this.$emit('update:show', true)
267
285
  this.$emit('open')
268
286
  },
269
287
  // 关闭tooltip
270
288
  close() {
289
+ if (activeSingletonTooltip === this) {
290
+ activeSingletonTooltip = null
291
+ }
292
+ if (!this.showTooltip) return
271
293
  this.showTooltip = false
294
+ this.$emit('update:show', false)
272
295
  this.$emit('close')
273
296
  },
297
+ clearActiveTooltip() {
298
+ if (activeSingletonTooltip === this) {
299
+ activeSingletonTooltip = null
300
+ }
301
+ },
274
302
  // 点击透明遮罩
275
303
  overlayClickHandler() {
276
304
  this.close()
@@ -405,4 +433,4 @@
405
433
  }
406
434
  }
407
435
  }
408
- </style>
436
+ </style>
@@ -1,5 +1,7 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import { registerComponentProps } from '../../libs/config/props.js'
3
+
4
+ const defProps = registerComponentProps({ tr: {} })
3
5
  export const props = defineMixin({
4
6
  props: {
5
7