oxy-uni-ui 1.2.3 → 2.0.0

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 (235) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +353 -328
  3. package/components/common/util.ts +185 -32
  4. package/components/composables/index.ts +1 -0
  5. package/components/composables/usePopover.ts +24 -20
  6. package/components/composables/useVirtualScroll.ts +10 -9
  7. package/components/composables/useWindowResize.ts +35 -0
  8. package/components/oxy-action-sheet/index.scss +24 -11
  9. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  10. package/components/oxy-action-sheet/types.ts +7 -0
  11. package/components/oxy-backtop/index.scss +3 -3
  12. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  13. package/components/oxy-backtop/types.ts +7 -7
  14. package/components/oxy-badge/index.scss +4 -4
  15. package/components/oxy-badge/oxy-badge.vue +3 -3
  16. package/components/oxy-badge/types.ts +2 -2
  17. package/components/oxy-button/index.scss +5 -5
  18. package/components/oxy-button/oxy-button.vue +5 -1
  19. package/components/oxy-calendar/index.scss +11 -11
  20. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  21. package/components/oxy-calendar/types.ts +5 -0
  22. package/components/oxy-calendar-view/month/index.scss +4 -4
  23. package/components/oxy-calendar-view/month/types.ts +36 -0
  24. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  25. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  26. package/components/oxy-calendar-view/year/index.scss +4 -4
  27. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  28. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  29. package/components/oxy-card/index.scss +2 -2
  30. package/components/oxy-cell/index.scss +8 -8
  31. package/components/oxy-checkbox/index.scss +7 -7
  32. package/components/oxy-checkbox-group/index.scss +2 -2
  33. package/components/oxy-circle/oxy-circle.vue +10 -7
  34. package/components/oxy-circle/types.ts +5 -5
  35. package/components/oxy-col/oxy-col.vue +2 -2
  36. package/components/oxy-col-picker/index.scss +4 -4
  37. package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
  38. package/components/oxy-col-picker/types.ts +7 -2
  39. package/components/oxy-collapse/index.scss +2 -2
  40. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  41. package/components/oxy-corner/index.scss +32 -32
  42. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  43. package/components/oxy-curtain/index.scss +15 -15
  44. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  45. package/components/oxy-curtain/types.ts +6 -1
  46. package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
  47. package/components/oxy-date-strip/types.ts +1 -1
  48. package/components/oxy-date-strip-item/index.scss +3 -3
  49. package/components/oxy-datetime-picker/index.scss +11 -11
  50. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
  51. package/components/oxy-datetime-picker/types.ts +5 -0
  52. package/components/oxy-drop-menu/index.scss +3 -3
  53. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  54. package/components/oxy-drop-menu-item/index.scss +1 -1
  55. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  56. package/components/oxy-drop-menu-item/types.ts +5 -0
  57. package/components/oxy-echarts/types.ts +6 -0
  58. package/components/oxy-fab/index.scss +8 -8
  59. package/components/oxy-fab/oxy-fab.vue +22 -3
  60. package/components/oxy-file-list/index.scss +24 -23
  61. package/components/oxy-file-list/oxy-file-list.vue +2 -2
  62. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  63. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  64. package/components/oxy-footer/index.scss +19 -0
  65. package/components/oxy-footer/oxy-footer.vue +78 -0
  66. package/components/oxy-footer/types.ts +17 -0
  67. package/components/oxy-form-item/types.ts +22 -1
  68. package/components/oxy-gap/oxy-gap.vue +2 -2
  69. package/components/oxy-gap/types.ts +2 -2
  70. package/components/oxy-grid/oxy-grid.vue +1 -1
  71. package/components/oxy-grid/types.ts +1 -1
  72. package/components/oxy-grid-item/index.scss +1 -1
  73. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  74. package/components/oxy-grid-item/types.ts +1 -1
  75. package/components/oxy-guidance/index.scss +75 -0
  76. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  77. package/components/oxy-guidance/types.ts +33 -0
  78. package/components/oxy-icon/oxy-icon.vue +2 -2
  79. package/components/oxy-icon/types.ts +1 -1
  80. package/components/oxy-img/oxy-img.vue +4 -4
  81. package/components/oxy-img/types.ts +3 -3
  82. package/components/oxy-img-cropper/index.scss +12 -12
  83. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  84. package/components/oxy-img-cropper/types.ts +2 -2
  85. package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
  86. package/components/oxy-img-lazy/types.ts +3 -3
  87. package/components/oxy-index-anchor/index.scss +2 -2
  88. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  89. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  90. package/components/oxy-index-bar/index.scss +3 -3
  91. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  92. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  93. package/components/oxy-input/index.scss +1 -1
  94. package/components/oxy-input-number/index.scss +5 -5
  95. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  96. package/components/oxy-input-number/types.ts +3 -2
  97. package/components/oxy-keyboard/index.scss +5 -5
  98. package/components/oxy-keyboard/key/index.scss +3 -3
  99. package/components/oxy-keyboard/key/index.vue +2 -2
  100. package/components/oxy-keyboard/key/types.ts +15 -0
  101. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  102. package/components/oxy-keyboard/types.ts +5 -0
  103. package/components/oxy-link/index.scss +2 -2
  104. package/components/oxy-list/oxy-list.vue +4 -3
  105. package/components/oxy-loading/oxy-loading.vue +8 -4
  106. package/components/oxy-loading/types.ts +1 -1
  107. package/components/oxy-loadmore/index.scss +3 -3
  108. package/components/oxy-long-press-menu/index.scss +93 -0
  109. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  110. package/components/oxy-long-press-menu/types.ts +34 -0
  111. package/components/oxy-message-box/index.scss +12 -11
  112. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  113. package/components/oxy-message-box/types.ts +14 -0
  114. package/components/oxy-navbar/index.scss +2 -2
  115. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  116. package/components/oxy-navbar/types.ts +8 -1
  117. package/components/oxy-navbar-capsule/types.ts +3 -0
  118. package/components/oxy-notice-bar/index.scss +3 -3
  119. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  120. package/components/oxy-notice-bar/types.ts +3 -3
  121. package/components/oxy-notify/index.ts +1 -0
  122. package/components/oxy-notify/oxy-notify.vue +3 -2
  123. package/components/oxy-notify/types.ts +7 -0
  124. package/components/oxy-pagination/index.scss +1 -1
  125. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  126. package/components/oxy-password-input/types.ts +1 -1
  127. package/components/oxy-picker/index.scss +45 -2
  128. package/components/oxy-picker/oxy-picker.vue +100 -14
  129. package/components/oxy-picker/types.ts +29 -1
  130. package/components/oxy-picker-view/index.scss +3 -3
  131. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  132. package/components/oxy-popover/index.scss +9 -9
  133. package/components/oxy-popup/index.scss +2 -2
  134. package/components/oxy-popup/oxy-popup.vue +35 -2
  135. package/components/oxy-popup/types.ts +8 -1
  136. package/components/oxy-progress/index.scss +3 -3
  137. package/components/oxy-qrcode/draw.ts +398 -0
  138. package/components/oxy-qrcode/index.scss +2 -0
  139. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  140. package/components/oxy-qrcode/qrcode.ts +936 -0
  141. package/components/oxy-qrcode/types.ts +42 -0
  142. package/components/oxy-radio/index.scss +10 -10
  143. package/components/oxy-radio-group/index.scss +2 -2
  144. package/components/oxy-rate/types.ts +4 -4
  145. package/components/oxy-resize/index.scss +2 -2
  146. package/components/oxy-resize/oxy-resize.vue +4 -4
  147. package/components/oxy-resize/types.ts +3 -0
  148. package/components/oxy-rich-text/index.scss +30 -29
  149. package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
  150. package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
  151. package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
  152. package/components/oxy-rich-text/types.ts +6 -1
  153. package/components/oxy-row/oxy-row.vue +3 -3
  154. package/components/oxy-row/types.ts +1 -1
  155. package/components/oxy-search/index.scss +3 -3
  156. package/components/oxy-segmented/index.scss +16 -16
  157. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  158. package/components/oxy-select/index.scss +144 -68
  159. package/components/oxy-select/oxy-select.vue +85 -50
  160. package/components/oxy-select/types.ts +13 -1
  161. package/components/oxy-select-picker/index.scss +7 -7
  162. package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
  163. package/components/oxy-select-picker/types.ts +2 -0
  164. package/components/oxy-sidebar-item/index.scss +1 -1
  165. package/components/oxy-signature/oxy-signature.vue +18 -10
  166. package/components/oxy-signature/types.ts +106 -13
  167. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  168. package/components/oxy-skeleton/types.ts +1 -1
  169. package/components/oxy-slider/index.scss +3 -3
  170. package/components/oxy-sort-button/index.scss +8 -8
  171. package/components/oxy-status-tip/index.scss +4 -4
  172. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  173. package/components/oxy-status-tip/types.ts +3 -3
  174. package/components/oxy-step/index.scss +14 -14
  175. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  176. package/components/oxy-stream-render/types.ts +4 -1
  177. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  178. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  179. package/components/oxy-swiper/types.ts +5 -5
  180. package/components/oxy-switch/index.scss +8 -8
  181. package/components/oxy-switch/oxy-switch.vue +2 -2
  182. package/components/oxy-switch/types.ts +1 -1
  183. package/components/oxy-tab/index.scss +11 -1
  184. package/components/oxy-tabbar/index.scss +1 -1
  185. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  186. package/components/oxy-table/index.scss +5 -5
  187. package/components/oxy-table/oxy-table.vue +8 -6
  188. package/components/oxy-table/types.ts +2 -2
  189. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  190. package/components/oxy-table-col/types.ts +2 -2
  191. package/components/oxy-tabs/index.scss +43 -15
  192. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  193. package/components/oxy-tabs/types.ts +15 -3
  194. package/components/oxy-tag/index.scss +15 -15
  195. package/components/oxy-text/index.scss +5 -1
  196. package/components/oxy-text/oxy-text.vue +76 -7
  197. package/components/oxy-text/types.ts +12 -0
  198. package/components/oxy-textarea/index.scss +6 -6
  199. package/components/oxy-toast/oxy-toast.vue +24 -8
  200. package/components/oxy-tooltip/index.scss +9 -9
  201. package/components/oxy-tree/index.scss +51 -15
  202. package/components/oxy-tree/oxy-tree.vue +13 -9
  203. package/components/oxy-tree/types.ts +12 -9
  204. package/components/oxy-upload/index.scss +21 -21
  205. package/components/oxy-upload/types.ts +2 -2
  206. package/components/oxy-verification-code/index.scss +6 -0
  207. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  208. package/components/oxy-verification-code/types.ts +82 -0
  209. package/components/oxy-video-preview/index.scss +4 -4
  210. package/components/oxy-virtual-scroll/index.scss +4 -4
  211. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  212. package/components/oxy-virtual-scroll/types.ts +14 -14
  213. package/components/oxy-voice-player/index.scss +908 -0
  214. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  215. package/components/oxy-voice-player/types.ts +567 -0
  216. package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
  217. package/components/oxy-waterfall/types.ts +6 -6
  218. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  219. package/components/oxy-watermark/types.ts +14 -14
  220. package/global.d.ts +2 -0
  221. package/locale/lang/ar-SA.ts +3 -0
  222. package/locale/lang/en-US.ts +3 -0
  223. package/locale/lang/zh-CN.ts +3 -0
  224. package/package.json +97 -1
  225. package/tags.json +1 -1
  226. package/web-types.json +1 -1
  227. package/components/oxy-number-keyboard/index.scss +0 -78
  228. package/components/oxy-number-keyboard/key/index.scss +0 -81
  229. package/components/oxy-number-keyboard/key/index.vue +0 -78
  230. package/components/oxy-number-keyboard/key/types.ts +0 -11
  231. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  232. package/components/oxy-number-keyboard/types.ts +0 -83
  233. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  234. package/components/oxy-tree/index.ts +0 -51
  235. package/oxy-uni-ui.zip +0 -0
@@ -2,7 +2,7 @@
2
2
  <view class="oxy-rich-text" :style="customStyle" :class="{ editable }">
3
3
  <view v-if="editable" class="editor_toolbox">
4
4
  <template v-for="(button, index) in toolButtons" :key="index">
5
- <image width="16px" height="16px" v-if="button.icon" :src="button.icon" alt="" @click="button.tap()" />
5
+ <image width="32rpx" height="32rpx" v-if="button.icon" :src="button.icon" alt="" @click="button.tap()" />
6
6
  <oxy-icon v-else size="18" :name="button.name" :class="button.class" @click="button.tap()" />
7
7
  </template>
8
8
  </view>
@@ -20,7 +20,7 @@
20
20
  ></mp-html>
21
21
  </view>
22
22
 
23
- <oxy-popup v-model="dialog" position="bottom" closable @close="dialog = false">
23
+ <oxy-popup v-model="dialog" position="bottom" :max-width="popupMaxWidth" closable @close="dialog = false">
24
24
  <view class="oxy-rich-text__popup">
25
25
  <view class="dialog-title">{{ translate('insert' + (dialogType === 'emoji' ? 'Emoji' : 'Template')) }}</view>
26
26
  <template v-if="dialogType === 'emoji'">
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
  </view>
42
42
  </oxy-popup>
43
- <oxy-popup v-model="linkDialog" position="bottom" closable @close="linkDialog = false">
43
+ <oxy-popup v-model="linkDialog" position="bottom" :max-width="popupMaxWidth" closable @close="linkDialog = false">
44
44
  <view class="oxy-rich-text__popup">
45
45
  <view class="dialog-title">{{ translate('insertLink') }}</view>
46
46
  <view class="oxy-rich-text__link-input">
@@ -110,9 +110,9 @@ const emit = defineEmits<{
110
110
  }>()
111
111
  const { translate } = useTranslate('richText')
112
112
  const templates = [
113
- '<section style="text-align: center; margin: 0px auto;"><section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"><span style="font-size: 18px; color: #595959;">标题</span></section></section>',
114
- '<div style="width: 100%; box-sizing: border-box; border-radius: 5px; background-color: #f6f6f6; padding: 10px; margin: 10px 0"><div>卡片</div><div style="font-size: 12px; color: gray">正文</div></div>',
115
- '<div style="border: 1px solid gray; box-shadow: 3px 3px 0px #cfcfce; padding: 10px; margin: 10px 0">段落</div>'
113
+ '<section style="text-align: center; margin: 0 auto;"><section style="border-radius: 8rpx; border: 1px solid #757576; display: inline-block; padding: 10rpx 40rpx;"><span style="font-size: 36rpx; color: #595959;">标题</span></section></section>',
114
+ '<div style="width: 100%; box-sizing: border-box; border-radius: 10rpx; background-color: #f6f6f6; padding: 20rpx; margin: 20rpx 0"><div>卡片</div><div style="font-size: 24rpx; color: gray">正文</div></div>',
115
+ '<div style="border: 1px solid gray; box-shadow: 6rpx 6rpx 0 #cfcfce; padding: 20rpx; margin: 20rpx 0">段落</div>'
116
116
  ]
117
117
  const emojis = [
118
118
  ['😄', '😷', '😂', '😝', '😳', '😱', '😔', '😒', '😉'],
@@ -143,61 +143,61 @@ const actions = ref([
143
143
 
144
144
  const customTagStyle = {
145
145
  p: `
146
- font-size: 16px;
146
+ font-size: 32rpx;
147
147
  color: var(--oxy-rich-text-primary-color, #262626);
148
148
  `,
149
149
  h1: `
150
- margin:18px 0 10px 0;
151
- font-size: 24px;
150
+ margin: 36rpx 0 20rpx 0;
151
+ font-size: 48rpx;
152
152
  font-weight: 700;
153
153
  color: var(--oxy-rich-text-title-color, #000);
154
154
  `,
155
155
  h2: `
156
- margin:14px 0 10px 0;
157
- font-size: 20px;
156
+ margin: 28rpx 0 20rpx 0;
157
+ font-size: 40rpx;
158
158
  font-weight: 600;
159
159
  color: var(--oxy-rich-text-title-color, #000);
160
160
  `,
161
161
  h3: `
162
- margin:12px 0 8px 0;
163
- font-size: 18px;
162
+ margin: 24rpx 0 16rpx 0;
163
+ font-size: 36rpx;
164
164
  font-weight: 600;
165
165
  color: var(--oxy-rich-text-title-color, #000);
166
166
  `,
167
167
  h4: `
168
- margin:12px 0 8px 0;
169
- font-size: 16px;
168
+ margin: 24rpx 0 16rpx 0;
169
+ font-size: 32rpx;
170
170
  font-weight: 600;
171
171
  color: var(--oxy-rich-text-title-color, #000);
172
172
  `,
173
173
  h5: `
174
- margin:10px 0 8px 0;
175
- font-size: 15px;
174
+ margin: 20rpx 0 16rpx 0;
175
+ font-size: 30rpx;
176
176
  font-weight: 600;
177
177
  color: var(--oxy-rich-text-title-color, #000);
178
178
  `,
179
179
  h6: `
180
- margin:8px 0 8px 0;
181
- font-size: 14px;
180
+ margin: 16rpx 0;
181
+ font-size: 28rpx;
182
182
  color: var(--oxy-rich-text-title-color, #000);
183
183
  `,
184
184
  blockquote: `
185
- margin:14px 0;
186
- padding: 10px 12px;
185
+ margin: 28rpx 0;
186
+ padding: 20rpx 24rpx;
187
187
  color: var(--oxy-rich-text-blockquote-color, #555);
188
188
  background: var(--oxy-rich-text-blockquote-bg, #f7f8fa);
189
- border-left: 4px solid var(--oxy-rich-text-blockquote-border-color, #007AFF);
189
+ border-left: 8rpx solid var(--oxy-rich-text-blockquote-border-color, #007AFF);
190
190
  `,
191
191
  'blockquote>p': `
192
192
  margin-block-start: 0;
193
193
  margin-block-end: 0;
194
194
  `,
195
195
  ul: `
196
- margin: 0 0 10px 0;
196
+ margin: 0 0 20rpx 0;
197
197
  color: var(--oxy-rich-text-list-color, #444);
198
198
  `,
199
199
  li: `
200
- margin: 6px 0;
200
+ margin: 12rpx 0;
201
201
  line-height: 1.65;
202
202
  color: var(--oxy-rich-text-list-color, #444);
203
203
  `,
@@ -218,35 +218,35 @@ const customTagStyle = {
218
218
  padding: 0;
219
219
  border: none;
220
220
  background: var(--oxy-rich-text-hr-color, #e5e6eb);
221
- margin: 18px 0;
221
+ margin: 36rpx 0;
222
222
  `,
223
223
  table: `
224
224
  border-spacing: 0;
225
225
  overflow: auto;
226
226
  min-width: 100%;
227
- margin: 12px 0;
227
+ margin: 24rpx 0;
228
228
  border-collapse: collapse;
229
229
  `,
230
230
  th: `
231
231
  border: 1px solid var(--oxy-rich-text-table-border-color, #e5e6eb);
232
232
  background: var(--oxy-rich-text-table-head-bg, #f7f8fa);
233
233
  color: var(--oxy-rich-text-table-head-color, #333);
234
- padding: 8px 12px;
234
+ padding: 16rpx 24rpx;
235
235
  font-weight: 600;
236
236
  `,
237
237
  td: `
238
238
  border: 1px solid var(--oxy-rich-text-table-border-color, #e5e6eb);
239
239
  color: var(--oxy-rich-text-table-text-color, #444);
240
- padding: 8px 12px;
240
+ padding: 16rpx 24rpx;
241
241
  `,
242
242
  pre: `
243
- border-radius: 6px;
243
+ border-radius: 12rpx;
244
244
  white-space: pre;
245
245
  background: var(--oxy-rich-text-code-bg, #2d2d2d);
246
246
  color: var(--oxy-rich-text-code-color, #f8f8f2);
247
- font-size: 13px;
247
+ font-size: 26rpx;
248
248
  line-height: 1.65;
249
- padding: 12px;
249
+ padding: 24rpx;
250
250
  overflow: auto;
251
251
  position: relative;
252
252
  `
@@ -1,5 +1,5 @@
1
1
  import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
2
- import { baseProps } from '../common/props'
2
+ import { baseProps, makeStringProp } from '../common/props'
3
3
 
4
4
  export const richTextProps = {
5
5
  ...baseProps,
@@ -15,6 +15,11 @@ export const richTextProps = {
15
15
  type: Boolean,
16
16
  default: false
17
17
  },
18
+ /**
19
+ * 弹层最大宽度,支持 `rpx`、`px`、`%` 等单位;
20
+ * `%` 在弹层打开时按屏幕宽度换算为 `rpx`
21
+ */
22
+ popupMaxWidth: makeStringProp('1200rpx'),
18
23
  uploadMethod: {
19
24
  type: Function as any,
20
25
  default: null
@@ -18,7 +18,7 @@ export default {
18
18
  import { computed, type CSSProperties } from 'vue'
19
19
  import { useChildren } from '../composables/useChildren'
20
20
  import { ROW_KEY, rowProps } from './types'
21
- import { addUnit, objToStyle } from '../common/util'
21
+ import { withDefaultUnit, objToStyle } from '../common/util'
22
22
 
23
23
  const props = defineProps(rowProps)
24
24
  const { linkChildren } = useChildren(ROW_KEY)
@@ -31,8 +31,8 @@ const rowStyle = computed(() => {
31
31
  if (gutter < 0) {
32
32
  console.error('[Oxy ui] warning(oxy-row): attribute gutter must be greater than or equal to 0')
33
33
  } else if (gutter) {
34
- style.marginLeft = addUnit(gutter / 2)
35
- style.marginRight = addUnit(gutter / 2)
34
+ style.marginLeft = withDefaultUnit(gutter / 2)
35
+ style.marginRight = withDefaultUnit(gutter / 2)
36
36
  }
37
37
  return `${objToStyle(style)}${props.customStyle}`
38
38
  })
@@ -10,7 +10,7 @@ export const ROW_KEY: InjectionKey<RowProvide> = Symbol('oxy-row')
10
10
  export const rowProps = {
11
11
  ...baseProps,
12
12
  /**
13
- * 列元素之间的间距(单位为px
13
+ * 列元素之间的间距(单位为rpx
14
14
  */
15
15
  gutter: makeNumberProp(0)
16
16
  }
@@ -97,7 +97,7 @@
97
97
  align-items: center;
98
98
  }
99
99
  @include edeep(search-icon) {
100
- margin-right: 8px;
100
+ margin-right: 16rpx;
101
101
  color: $-search-icon-color;
102
102
  font-size: $-search-icon-size;
103
103
  }
@@ -105,7 +105,7 @@
105
105
  position: absolute;
106
106
  font-size: $-search-icon-size;
107
107
  top: 50%;
108
- left: 16px;
108
+ left: 32rpx;
109
109
  transform: translateY(-50%);
110
110
  color: $-search-icon-color;
111
111
  }
@@ -116,7 +116,7 @@
116
116
  @include edeep(clear) {
117
117
  position: absolute;
118
118
  right: 0;
119
- padding: 6px 9px 6px 7px;
119
+ padding: 12rpx 18rpx 12rpx 14rpx;
120
120
  color: $-search-cancel-color;
121
121
  }
122
122
  @include edeep(clear-icon) {
@@ -40,21 +40,21 @@
40
40
  width: 100%;
41
41
  background-color: $-segmented-item-bg-color;
42
42
  padding: $-segmented-padding;
43
- border-radius: 4px;
43
+ border-radius: 8rpx;
44
44
  box-sizing: border-box;
45
45
 
46
46
 
47
47
  @include e(item) {
48
48
  position: relative;
49
49
  text-align: center;
50
- border-radius: 4px;
50
+ border-radius: 8rpx;
51
51
  flex: 1;
52
52
  min-width: 0;
53
53
  z-index: 1;
54
- min-height: 28px;
55
- line-height: 28px;
56
- padding: 0 12px;
57
- font-size: 14px;
54
+ min-height: 56rpx;
55
+ line-height: 56rpx;
56
+ padding: 0 24rpx;
57
+ font-size: 28rpx;
58
58
  color: $-segmented-item-color;
59
59
  font-weight: 400;
60
60
 
@@ -63,18 +63,18 @@
63
63
  }
64
64
 
65
65
  @include when(large) {
66
- min-height: 32px;
67
- line-height: 32px;
68
- padding: 0 12px;
69
- font-size: 16px;
66
+ min-height: 64rpx;
67
+ line-height: 64rpx;
68
+ padding: 0 24rpx;
69
+ font-size: 32rpx;
70
70
  }
71
71
 
72
72
 
73
73
  @include when(small) {
74
- min-height: 24px;
75
- line-height: 24px;
76
- padding: 0 7px;
77
- font-size: 12px;
74
+ min-height: 48rpx;
75
+ line-height: 48rpx;
76
+ padding: 0 14rpx;
77
+ font-size: 24rpx;
78
78
  }
79
79
 
80
80
  @include when(disabled) {
@@ -84,7 +84,7 @@
84
84
 
85
85
  @include m(active) {
86
86
  background-color: $-segmented-item-acitve-bg;
87
- border-radius: 4px;
87
+ border-radius: 8rpx;
88
88
  height: calc(100% - $-segmented-padding * 2);
89
89
  @include when(disabled) {
90
90
  opacity: 0.8;
@@ -98,4 +98,4 @@
98
98
  text-overflow: ellipsis;
99
99
  }
100
100
 
101
- }
101
+ }
@@ -32,9 +32,10 @@ export default {
32
32
 
33
33
  <script setup lang="ts">
34
34
  import { computed, getCurrentInstance, onMounted, reactive, watch } from 'vue'
35
- import { getRect, isObj, objToStyle, addUnit, pause, isEqual } from '../common/util'
35
+ import { getRect, isObj, objToStyle, pause, isEqual, unitConvert } from '../common/util'
36
36
  import type { CSSProperties } from 'vue'
37
37
  import { segmentedProps, type SegmentedExpose, type SegmentedOption } from './types'
38
+ import { useWindowResize } from '../composables/useWindowResize'
38
39
  const $item = '.oxy-segmented__item'
39
40
 
40
41
  const props = defineProps(segmentedProps)
@@ -63,7 +64,24 @@ watch(
63
64
  }
64
65
  )
65
66
 
67
+ watch(
68
+ () => props.options,
69
+ async () => {
70
+ updateCurrentIndex()
71
+ await pause()
72
+ updateActiveStyle(false)
73
+ },
74
+ {
75
+ deep: true
76
+ }
77
+ )
78
+
66
79
  const { proxy } = getCurrentInstance() as any
80
+ const handleWindowResize = async () => {
81
+ await pause()
82
+ updateActiveStyle(false)
83
+ }
84
+ useWindowResize(handleWindowResize)
67
85
 
68
86
  onMounted(async () => {
69
87
  updateCurrentIndex()
@@ -77,15 +95,17 @@ onMounted(async () => {
77
95
  */
78
96
  function updateActiveStyle(animation: boolean = true) {
79
97
  getRect($item, true, proxy).then((rects) => {
98
+ if (!Array.isArray(rects) || rects.length === 0 || !rects[state.activeIndex]) return
80
99
  const rect = rects[state.activeIndex]
81
100
  const style: CSSProperties = {
82
101
  position: 'absolute',
83
- width: addUnit(rect.width!),
102
+ // getRect 返回的是真实像素值,需按 px 输出避免宽屏下激活块尺寸偏大
103
+ width: unitConvert(rect.width, 0, { output: 'px' }),
84
104
  'z-index': 0
85
105
  }
86
106
  const left = rects.slice(0, state.activeIndex).reduce((prev, curr) => prev + Number(curr.width), 0)
87
107
  if (left) {
88
- style.transform = `translateX(${left}px)`
108
+ style.transform = `translateX(${unitConvert(left, 0, { output: 'px' })})`
89
109
  }
90
110
  if (animation) {
91
111
  style.transition = 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)'