oxy-uni-ui 1.2.0 → 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.
- package/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +396 -321
- package/components/common/path.ts +9 -0
- package/components/common/util.ts +200 -5
- package/components/composables/index.ts +1 -0
- package/components/composables/useGlobalLoading.ts +42 -0
- package/components/composables/useGlobalMessage.ts +48 -0
- package/components/composables/useGlobalToast.ts +84 -0
- package/components/composables/usePopover.ts +24 -20
- package/components/composables/useVirtualScroll.ts +13 -11
- package/components/composables/useWindowResize.ts +35 -0
- package/components/oxy-action-sheet/index.scss +24 -11
- package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
- package/components/oxy-action-sheet/types.ts +7 -0
- package/components/oxy-backtop/index.scss +3 -3
- package/components/oxy-backtop/oxy-backtop.vue +9 -6
- package/components/oxy-backtop/types.ts +7 -7
- package/components/oxy-badge/index.scss +4 -4
- package/components/oxy-badge/oxy-badge.vue +3 -3
- package/components/oxy-badge/types.ts +2 -2
- package/components/oxy-button/index.scss +5 -5
- package/components/oxy-button/oxy-button.vue +5 -1
- package/components/oxy-calendar/index.scss +11 -11
- package/components/oxy-calendar/oxy-calendar.vue +1 -0
- package/components/oxy-calendar/types.ts +5 -0
- package/components/oxy-calendar-view/month/index.scss +4 -4
- package/components/oxy-calendar-view/month/types.ts +36 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
- package/components/oxy-calendar-view/year/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
- package/components/oxy-card/index.scss +2 -2
- package/components/oxy-cell/index.scss +8 -8
- package/components/oxy-cell/oxy-cell.vue +15 -2
- package/components/oxy-cell/types.ts +4 -0
- package/components/oxy-checkbox/index.scss +8 -8
- package/components/oxy-checkbox/oxy-checkbox.vue +2 -2
- package/components/oxy-checkbox-group/index.scss +2 -2
- package/components/oxy-circle/oxy-circle.vue +10 -7
- package/components/oxy-circle/types.ts +5 -5
- package/components/oxy-col/oxy-col.vue +2 -2
- package/components/oxy-col-picker/index.scss +4 -4
- package/components/oxy-col-picker/oxy-col-picker.vue +9 -5
- package/components/oxy-col-picker/types.ts +12 -3
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
- package/components/oxy-corner/index.scss +32 -32
- package/components/oxy-corner/oxy-corner.vue +15 -3
- package/components/oxy-corner/types.ts +15 -1
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-curtain/index.scss +15 -15
- package/components/oxy-curtain/oxy-curtain.vue +4 -2
- package/components/oxy-curtain/types.ts +6 -1
- package/components/oxy-date-strip/index.scss +10 -0
- package/components/oxy-date-strip/oxy-date-strip.vue +198 -0
- package/components/oxy-date-strip/types.ts +98 -0
- package/components/oxy-date-strip/utils.ts +67 -0
- package/components/oxy-date-strip-item/index.scss +94 -0
- package/components/oxy-date-strip-item/oxy-date-strip-item.vue +102 -0
- package/components/oxy-date-strip-item/types.ts +53 -0
- package/components/oxy-datetime-picker/index.scss +11 -11
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +4 -1
- package/components/oxy-datetime-picker/types.ts +10 -1
- package/components/oxy-drop-menu/index.scss +3 -3
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
- package/components/oxy-drop-menu-item/types.ts +5 -0
- package/components/oxy-echarts/index.scss +17 -0
- package/components/oxy-echarts/index.ts +1 -0
- package/components/oxy-echarts/oxy-echarts.vue +32 -0
- package/components/oxy-echarts/types.ts +18 -0
- package/components/oxy-fab/index.scss +8 -8
- package/components/oxy-fab/oxy-fab.vue +22 -3
- package/components/oxy-file-list/index.scss +42 -15
- package/components/oxy-file-list/oxy-file-list.vue +208 -34
- package/components/oxy-file-list/types.ts +58 -2
- package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
- package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
- package/components/oxy-footer/index.scss +19 -0
- package/components/oxy-footer/oxy-footer.vue +78 -0
- package/components/oxy-footer/types.ts +17 -0
- package/components/oxy-form-item/types.ts +22 -1
- package/components/oxy-gap/oxy-gap.vue +2 -2
- package/components/oxy-gap/types.ts +2 -2
- package/components/oxy-global-loading/oxy-global-loading.vue +53 -0
- package/components/oxy-global-message/oxy-global-message.vue +64 -0
- package/components/oxy-global-toast/oxy-global-toast.vue +53 -0
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid/types.ts +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
- package/components/oxy-grid-item/types.ts +1 -1
- package/components/oxy-guidance/index.scss +75 -0
- package/components/oxy-guidance/oxy-guidance.vue +201 -0
- package/components/oxy-guidance/types.ts +33 -0
- package/components/oxy-icon/oxy-icon.vue +2 -2
- package/components/oxy-icon/types.ts +1 -1
- package/components/oxy-img/oxy-img.vue +4 -4
- package/components/oxy-img/types.ts +3 -3
- package/components/oxy-img-cropper/index.scss +12 -12
- package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
- package/components/oxy-img-cropper/types.ts +2 -2
- package/components/oxy-img-lazy/index.scss +17 -0
- package/components/oxy-img-lazy/oxy-img-lazy.vue +332 -0
- package/components/oxy-img-lazy/types.ts +69 -0
- package/components/oxy-index-anchor/index.scss +2 -2
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
- package/components/oxy-index-bar/index.scss +3 -3
- package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
- package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
- package/components/oxy-input/index.scss +1 -1
- package/components/oxy-input-number/index.scss +5 -5
- package/components/oxy-input-number/oxy-input-number.vue +2 -2
- package/components/oxy-input-number/types.ts +3 -2
- package/components/oxy-keyboard/index.scss +5 -5
- package/components/oxy-keyboard/key/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -2
- package/components/oxy-keyboard/key/types.ts +15 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
- package/components/oxy-keyboard/types.ts +5 -0
- package/components/oxy-link/index.scss +57 -0
- package/components/oxy-link/oxy-link.vue +130 -0
- package/components/oxy-link/types.ts +81 -0
- package/components/oxy-list/index.scss +7 -1
- package/components/oxy-list/oxy-list.vue +4 -3
- package/components/oxy-list/types.ts +1 -1
- package/components/oxy-loading/oxy-loading.vue +8 -4
- package/components/oxy-loading/types.ts +1 -1
- package/components/oxy-loadmore/index.scss +3 -3
- package/components/oxy-long-press-menu/index.scss +93 -0
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
- package/components/oxy-long-press-menu/types.ts +34 -0
- package/components/oxy-message-box/index.scss +12 -11
- package/components/oxy-message-box/oxy-message-box.vue +11 -3
- package/components/oxy-message-box/types.ts +14 -0
- package/components/oxy-navbar/index.scss +2 -2
- package/components/oxy-navbar/oxy-navbar.vue +58 -13
- package/components/oxy-navbar/types.ts +8 -1
- package/components/oxy-navbar-capsule/types.ts +3 -0
- package/components/oxy-notice-bar/index.scss +3 -3
- package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
- package/components/oxy-notice-bar/types.ts +3 -3
- package/components/oxy-notify/index.ts +1 -0
- package/components/oxy-notify/oxy-notify.vue +3 -2
- package/components/oxy-notify/types.ts +7 -0
- package/components/oxy-pagination/index.scss +1 -1
- package/components/oxy-password-input/oxy-password-input.vue +2 -2
- package/components/oxy-password-input/types.ts +1 -1
- package/components/oxy-picker/index.scss +45 -2
- package/components/oxy-picker/oxy-picker.vue +103 -14
- package/components/oxy-picker/types.ts +33 -1
- package/components/oxy-picker-view/index.scss +3 -3
- package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
- package/components/oxy-popover/index.scss +9 -9
- package/components/oxy-popup/index.scss +2 -2
- package/components/oxy-popup/oxy-popup.vue +35 -2
- package/components/oxy-popup/types.ts +8 -1
- package/components/oxy-progress/index.scss +3 -3
- package/components/oxy-qrcode/draw.ts +398 -0
- package/components/oxy-qrcode/index.scss +2 -0
- package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
- package/components/oxy-qrcode/qrcode.ts +936 -0
- package/components/oxy-qrcode/types.ts +42 -0
- package/components/oxy-radio/index.scss +13 -13
- package/components/oxy-radio/oxy-radio.vue +1 -1
- package/components/oxy-radio-group/index.scss +2 -2
- package/components/oxy-rate/types.ts +4 -4
- package/components/oxy-resize/index.scss +2 -2
- package/components/oxy-resize/oxy-resize.vue +4 -4
- package/components/oxy-resize/types.ts +3 -0
- package/components/oxy-rich-text/icon/emjio.svg +1 -0
- package/components/oxy-rich-text/icon/quote.svg +1 -0
- package/components/oxy-rich-text/icon/text.svg +1 -0
- package/components/oxy-rich-text/icon/title.svg +1 -0
- package/components/oxy-rich-text/index.scss +160 -0
- package/components/oxy-rich-text/mp-html/card/card.vue +122 -0
- package/components/oxy-rich-text/mp-html/card/index.js +7 -0
- package/components/oxy-rich-text/mp-html/editable/config.js +15 -0
- package/components/oxy-rich-text/mp-html/editable/index.js +553 -0
- package/components/oxy-rich-text/mp-html/emoji/index.js +203 -0
- package/components/oxy-rich-text/mp-html/highlight/config.js +5 -0
- package/components/oxy-rich-text/mp-html/highlight/index.js +96 -0
- package/components/oxy-rich-text/mp-html/highlight/prism.css +1 -0
- package/components/oxy-rich-text/mp-html/highlight/prism.min.js +7 -0
- package/components/oxy-rich-text/mp-html/img-cache/index.js +138 -0
- package/components/oxy-rich-text/mp-html/latex/index.js +80 -0
- package/components/oxy-rich-text/mp-html/latex/katex.css +1 -0
- package/components/oxy-rich-text/mp-html/latex/katex.min.js +1 -0
- package/components/oxy-rich-text/mp-html/markdown/index.js +50 -0
- package/components/oxy-rich-text/mp-html/markdown/marked.min.js +71 -0
- package/components/oxy-rich-text/mp-html/mp-html.d.ts +184 -0
- package/components/oxy-rich-text/mp-html/mp-html.vue +684 -0
- package/components/oxy-rich-text/mp-html/node/node.vue +1172 -0
- package/components/oxy-rich-text/mp-html/parser.js +1428 -0
- package/components/oxy-rich-text/mp-html/search/index.js +132 -0
- package/components/oxy-rich-text/mp-html/style/index.js +129 -0
- package/components/oxy-rich-text/mp-html/style/parser.js +175 -0
- package/components/oxy-rich-text/mp-html/template/index.js +67 -0
- package/components/oxy-rich-text/mp-html/txv-video/index.js +46 -0
- package/components/oxy-rich-text/oxy-rich-text.vue +642 -0
- package/components/oxy-rich-text/types.ts +76 -0
- package/components/oxy-row/oxy-row.vue +3 -3
- package/components/oxy-row/types.ts +1 -1
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-segmented/index.scss +16 -16
- package/components/oxy-segmented/oxy-segmented.vue +23 -3
- package/components/oxy-select/index.scss +331 -0
- package/components/oxy-select/oxy-select.vue +456 -0
- package/components/oxy-select/types.ts +83 -0
- package/components/oxy-select-picker/index.scss +7 -7
- package/components/oxy-select-picker/oxy-select-picker.vue +4 -0
- package/components/oxy-select-picker/types.ts +7 -1
- package/components/oxy-sidebar-item/index.scss +1 -1
- package/components/oxy-signature/oxy-signature.vue +18 -10
- package/components/oxy-signature/types.ts +106 -13
- package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
- package/components/oxy-skeleton/types.ts +1 -1
- package/components/oxy-slider/index.scss +3 -3
- package/components/oxy-sort-button/index.scss +8 -8
- package/components/oxy-status-tip/index.scss +4 -4
- package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
- package/components/oxy-status-tip/types.ts +3 -3
- package/components/oxy-step/index.scss +14 -14
- package/components/oxy-sticky/oxy-sticky.vue +6 -6
- package/components/oxy-stream-render/index.scss +6 -0
- package/components/oxy-stream-render/oxy-stream-render.vue +204 -0
- package/components/oxy-stream-render/types.ts +8 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
- package/components/oxy-swiper/oxy-swiper.vue +6 -6
- package/components/oxy-swiper/types.ts +5 -5
- package/components/oxy-switch/index.scss +8 -8
- package/components/oxy-switch/oxy-switch.vue +2 -2
- package/components/oxy-switch/types.ts +1 -1
- package/components/oxy-tab/index.scss +11 -1
- package/components/oxy-tabbar/index.scss +1 -1
- package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
- package/components/oxy-table/index.scss +5 -5
- package/components/oxy-table/oxy-table.vue +8 -6
- package/components/oxy-table/types.ts +2 -2
- package/components/oxy-table-col/oxy-table-col.vue +3 -3
- package/components/oxy-table-col/types.ts +2 -2
- package/components/oxy-tabs/index.scss +43 -15
- package/components/oxy-tabs/oxy-tabs.vue +53 -19
- package/components/oxy-tabs/types.ts +15 -3
- package/components/oxy-tag/index.scss +15 -15
- package/components/oxy-text/index.scss +5 -1
- package/components/oxy-text/oxy-text.vue +76 -7
- package/components/oxy-text/types.ts +12 -0
- package/components/oxy-textarea/index.scss +6 -6
- package/components/oxy-toast/oxy-toast.vue +24 -8
- package/components/oxy-tooltip/index.scss +9 -9
- package/components/oxy-tree/index.scss +61 -9
- package/components/oxy-tree/oxy-tree.vue +102 -17
- package/components/oxy-tree/types.ts +23 -10
- package/components/oxy-upload/index.scss +21 -21
- package/components/oxy-upload/types.ts +2 -2
- package/components/oxy-verification-code/index.scss +6 -0
- package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
- package/components/oxy-verification-code/types.ts +82 -0
- package/components/oxy-video-preview/index.scss +4 -4
- package/components/oxy-virtual-scroll/index.scss +4 -4
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
- package/components/oxy-virtual-scroll/types.ts +14 -14
- package/components/oxy-voice-player/index.scss +908 -0
- package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
- package/components/oxy-voice-player/types.ts +567 -0
- package/components/oxy-waterfall/index.scss +18 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +218 -0
- package/components/oxy-waterfall/types.ts +90 -0
- package/components/oxy-waterfall-item/index.scss +8 -0
- package/components/oxy-waterfall-item/oxy-waterfall-item.vue +89 -0
- package/components/oxy-waterfall-item/types.ts +16 -0
- package/components/oxy-watermark/oxy-watermark.vue +35 -13
- package/components/oxy-watermark/types.ts +14 -14
- package/global.d.ts +9 -0
- package/index.ts +3 -0
- package/locale/lang/ar-SA.ts +3 -0
- package/locale/lang/en-US.ts +29 -0
- package/locale/lang/zh-CN.ts +29 -0
- package/package.json +97 -1
- package/tags.json +1 -1
- package/uni-echarts/changelog.md +2 -0
- package/uni-echarts/components/index.js +1 -0
- package/uni-echarts/components/uni-echarts/events.js +95 -0
- package/uni-echarts/components/uni-echarts/types.d.ts +183 -0
- package/uni-echarts/components/uni-echarts/types.js +1 -0
- package/uni-echarts/components/uni-echarts/uni-echarts.vue +530 -0
- package/uni-echarts/components/uni-echarts/uni-echarts.vue.d.ts +19 -0
- package/uni-echarts/global.d.ts +7 -0
- package/uni-echarts/index.d.ts +440 -0
- package/uni-echarts/index.js +2 -0
- package/uni-echarts/package.json +105 -0
- package/uni-echarts/shared-core.d.ts +269 -0
- package/uni-echarts/shared-core.js +900 -0
- package/web-types.json +1 -1
- package/components/oxy-number-keyboard/index.scss +0 -78
- package/components/oxy-number-keyboard/key/index.scss +0 -81
- package/components/oxy-number-keyboard/key/index.vue +0 -78
- package/components/oxy-number-keyboard/key/types.ts +0 -11
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
- package/components/oxy-number-keyboard/types.ts +0 -83
- package/components/oxy-tree/components/tree-node-content.vue +0 -72
- package/components/oxy-tree/index.ts +0 -51
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
@include when(active) {
|
|
32
32
|
color: $-dark-color;
|
|
33
|
-
border:
|
|
33
|
+
border: 2rpx solid $-tabs-nav-active-color;
|
|
34
34
|
background-color: $-dark-background;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
@include e(line) {
|
|
127
127
|
position: absolute;
|
|
128
|
-
bottom:
|
|
128
|
+
bottom: 8rpx;
|
|
129
129
|
left: 0;
|
|
130
130
|
z-index: 1;
|
|
131
131
|
height: $-tabs-nav-line-height;
|
|
@@ -139,6 +139,25 @@
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
@include edeep(nav-item-pills){
|
|
143
|
+
.oxy-tabs__nav-item-text {
|
|
144
|
+
padding: $-tabs-nav-pills-padding-y $-tabs-nav-pills-padding-x;
|
|
145
|
+
}
|
|
146
|
+
.oxy-tabs__nav-item-badge {
|
|
147
|
+
.oxy-badge__content {
|
|
148
|
+
margin-top: $-tabs-nav-pills-padding-y;
|
|
149
|
+
margin-right: $-tabs-nav-pills-padding-x;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
@include when(active) {
|
|
153
|
+
.oxy-tabs__nav-item-text {
|
|
154
|
+
background-color: $-tabs-nav-pills-bg-color;
|
|
155
|
+
border-radius: $-tabs-nav-pills-border-radius;
|
|
156
|
+
color: $-tabs-nav-pills-color;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
142
161
|
@include e(container) {
|
|
143
162
|
overflow: hidden;
|
|
144
163
|
}
|
|
@@ -179,8 +198,8 @@
|
|
|
179
198
|
position: absolute;
|
|
180
199
|
content: '';
|
|
181
200
|
top: 0;
|
|
182
|
-
left: -
|
|
183
|
-
width:
|
|
201
|
+
left: -48rpx;
|
|
202
|
+
width: 48rpx;
|
|
184
203
|
height: $-tabs-nav-height - 1;
|
|
185
204
|
background: $-tabs-nav-map-btn-before-bg;
|
|
186
205
|
}
|
|
@@ -197,7 +216,7 @@
|
|
|
197
216
|
|
|
198
217
|
@include e(map-header) {
|
|
199
218
|
position: relative;
|
|
200
|
-
padding-left:
|
|
219
|
+
padding-left: 34rpx;
|
|
201
220
|
height: $-tabs-nav-height;
|
|
202
221
|
line-height: $-tabs-nav-height;
|
|
203
222
|
font-size: $-tabs-nav-map-fs;
|
|
@@ -216,7 +235,7 @@
|
|
|
216
235
|
@include e(map-body) {
|
|
217
236
|
display: flex;
|
|
218
237
|
flex-wrap: wrap;
|
|
219
|
-
padding:
|
|
238
|
+
padding: 40rpx 30rpx 20rpx;
|
|
220
239
|
background: #fff;
|
|
221
240
|
transition: transform .3s;
|
|
222
241
|
transform: scaleY(0);
|
|
@@ -243,12 +262,12 @@
|
|
|
243
262
|
@include buttonClear;
|
|
244
263
|
@include lineEllipsis;
|
|
245
264
|
display: inline-block;
|
|
246
|
-
width:
|
|
247
|
-
height:
|
|
248
|
-
line-height:
|
|
265
|
+
width: 214rpx;
|
|
266
|
+
height: 64rpx;
|
|
267
|
+
line-height: 64rpx;
|
|
249
268
|
background-color: $-tabs-nav-map-button-back-color;
|
|
250
269
|
border-color: transparent;
|
|
251
|
-
margin-bottom:
|
|
270
|
+
margin-bottom: 20rpx;
|
|
252
271
|
border-radius: $-tabs-nav-map-button-radius;
|
|
253
272
|
color: $-tabs-nav-map-color;
|
|
254
273
|
font-size: $-tabs-nav-map-fs;
|
|
@@ -257,7 +276,7 @@
|
|
|
257
276
|
|
|
258
277
|
@include when(active) {
|
|
259
278
|
color: $-tabs-nav-active-color;
|
|
260
|
-
border:
|
|
279
|
+
border: 2rpx solid $-tabs-nav-active-color;
|
|
261
280
|
background-color: $-tabs-nav-bg
|
|
262
281
|
}
|
|
263
282
|
|
|
@@ -281,19 +300,28 @@
|
|
|
281
300
|
@include when(slide) {
|
|
282
301
|
.oxy-tabs__nav-item {
|
|
283
302
|
flex: 0 0 auto;
|
|
284
|
-
padding: 0
|
|
303
|
+
padding: 0 34rpx;
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
306
|
|
|
288
307
|
@include when(map) {
|
|
289
308
|
.oxy-tabs__nav--wrap {
|
|
290
|
-
padding-right:
|
|
309
|
+
padding-right: 80rpx;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@include when(fullscreen) {
|
|
314
|
+
height: 100%;
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
.oxy-tabs__container {
|
|
318
|
+
flex: 1;
|
|
291
319
|
}
|
|
292
320
|
}
|
|
293
321
|
}
|
|
294
322
|
|
|
295
323
|
@media screen and (max-width: 330px) {
|
|
296
324
|
.oxy-tabs__map-nav-btn {
|
|
297
|
-
width:
|
|
325
|
+
width: 180rpx;
|
|
298
326
|
}
|
|
299
|
-
}
|
|
327
|
+
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
<template v-if="sticky">
|
|
3
3
|
<oxy-sticky-box>
|
|
4
4
|
<view
|
|
5
|
-
:class="`oxy-tabs ${customClass} ${innerSlidable ? 'is-slide' : ''} ${mapNum < children.length && mapNum !== 0 ? 'is-map' : ''}
|
|
5
|
+
:class="`oxy-tabs ${customClass} ${innerSlidable ? 'is-slide' : ''} ${mapNum < children.length && mapNum !== 0 ? 'is-map' : ''} ${
|
|
6
|
+
fullscreen ? 'is-fullscreen' : ''
|
|
7
|
+
}`"
|
|
6
8
|
:style="customStyle"
|
|
7
9
|
>
|
|
8
10
|
<oxy-sticky :offset-top="offsetTop">
|
|
@@ -14,17 +16,32 @@
|
|
|
14
16
|
@click="handleSelect(index)"
|
|
15
17
|
v-for="(item, index) in children"
|
|
16
18
|
:key="index"
|
|
17
|
-
:class="`oxy-tabs__nav-item
|
|
19
|
+
:class="`oxy-tabs__nav-item ${props.pills ? 'oxy-tabs__nav-item-pills' : ''} ${state.activeIndex === index ? 'is-active' : ''} ${
|
|
20
|
+
item.disabled ? 'is-disabled' : ''
|
|
21
|
+
}`"
|
|
18
22
|
:style="state.activeIndex === index ? (color ? 'color:' + color : '') : inactiveColor ? 'color:' + inactiveColor : ''"
|
|
19
23
|
>
|
|
20
24
|
<oxy-badge v-if="item.badgeProps" v-bind="item.badgeProps">
|
|
21
|
-
<text
|
|
25
|
+
<text
|
|
26
|
+
class="oxy-tabs__nav-item-text"
|
|
27
|
+
:style="props.pills && props.pillsColor && state.activeIndex === index ? 'background-color:' + props.pillsColor : ''"
|
|
28
|
+
>
|
|
29
|
+
{{ item.title }}
|
|
30
|
+
</text>
|
|
22
31
|
</oxy-badge>
|
|
23
|
-
<text
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
<text
|
|
33
|
+
v-else
|
|
34
|
+
class="oxy-tabs__nav-item-text"
|
|
35
|
+
:style="props.pills && props.pillsColor && state.activeIndex === index ? 'background-color:' + props.pillsColor : ''"
|
|
36
|
+
>
|
|
37
|
+
{{ item.title }}
|
|
38
|
+
</text>
|
|
39
|
+
<view
|
|
40
|
+
class="oxy-tabs__line oxy-tabs__line--inner"
|
|
41
|
+
v-if="!props.pills && state.activeIndex === index && state.useInnerLine"
|
|
42
|
+
></view>
|
|
26
43
|
</view>
|
|
27
|
-
<view class="oxy-tabs__line" :style="state.lineStyle"></view>
|
|
44
|
+
<view v-if="!props.pills" class="oxy-tabs__line" :style="state.lineStyle"></view>
|
|
28
45
|
</view>
|
|
29
46
|
</scroll-view>
|
|
30
47
|
</view>
|
|
@@ -75,7 +92,11 @@
|
|
|
75
92
|
</template>
|
|
76
93
|
|
|
77
94
|
<template v-else>
|
|
78
|
-
<view
|
|
95
|
+
<view
|
|
96
|
+
:class="`oxy-tabs ${customClass} ${innerSlidable ? 'is-slide' : ''} ${mapNum < children.length && mapNum !== 0 ? 'is-map' : ''} ${
|
|
97
|
+
fullscreen ? 'is-fullscreen' : ''
|
|
98
|
+
}`"
|
|
99
|
+
>
|
|
79
100
|
<view class="oxy-tabs__nav">
|
|
80
101
|
<view class="oxy-tabs__nav--wrap">
|
|
81
102
|
<scroll-view :scroll-x="innerSlidable" scroll-with-animation :scroll-left="state.scrollLeft">
|
|
@@ -84,16 +105,29 @@
|
|
|
84
105
|
v-for="(item, index) in children"
|
|
85
106
|
@click="handleSelect(index)"
|
|
86
107
|
:key="index"
|
|
87
|
-
:class="`oxy-tabs__nav-item ${
|
|
108
|
+
:class="`oxy-tabs__nav-item ${props.pills ? 'oxy-tabs__nav-item-pills' : ''} ${state.activeIndex === index ? 'is-active' : ''} ${
|
|
109
|
+
item.disabled ? 'is-disabled' : ''
|
|
110
|
+
}`"
|
|
88
111
|
:style="state.activeIndex === index ? (color ? 'color:' + color : '') : inactiveColor ? 'color:' + inactiveColor : ''"
|
|
89
112
|
>
|
|
90
113
|
<oxy-badge custom-class="oxy-tabs__nav-item-badge" v-if="item.badgeProps" v-bind="item.badgeProps">
|
|
91
|
-
<text
|
|
114
|
+
<text
|
|
115
|
+
class="oxy-tabs__nav-item-text"
|
|
116
|
+
:style="props.pills && props.pillsColor && state.activeIndex === index ? 'background-color:' + props.pillsColor : ''"
|
|
117
|
+
>
|
|
118
|
+
{{ item.title }}
|
|
119
|
+
</text>
|
|
92
120
|
</oxy-badge>
|
|
93
|
-
<text
|
|
94
|
-
|
|
121
|
+
<text
|
|
122
|
+
v-else
|
|
123
|
+
class="oxy-tabs__nav-item-text"
|
|
124
|
+
:style="props.pills && props.pillsColor && state.activeIndex === index ? 'background-color:' + props.pillsColor : ''"
|
|
125
|
+
>
|
|
126
|
+
{{ item.title }}
|
|
127
|
+
</text>
|
|
128
|
+
<view class="oxy-tabs__line oxy-tabs__line--inner" v-if="!props.pills && state.activeIndex === index && state.useInnerLine"></view>
|
|
95
129
|
</view>
|
|
96
|
-
<view class="oxy-tabs__line" :style="state.lineStyle"></view>
|
|
130
|
+
<view v-if="!props.pills" class="oxy-tabs__line" :style="state.lineStyle"></view>
|
|
97
131
|
</view>
|
|
98
132
|
</scroll-view>
|
|
99
133
|
</view>
|
|
@@ -145,7 +179,7 @@ import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
|
145
179
|
import OxySticky from '../oxy-sticky/oxy-sticky.vue'
|
|
146
180
|
import OxyStickyBox from '../oxy-sticky-box/oxy-sticky-box.vue'
|
|
147
181
|
import { computed, getCurrentInstance, onMounted, watch, nextTick, reactive, type CSSProperties, type ComponentInstance } from 'vue'
|
|
148
|
-
import {
|
|
182
|
+
import { withDefaultUnit, checkNumRange, debounce, getRect, isDef, isNumber, isString, objToStyle, unitConvert } from '../common/util'
|
|
149
183
|
import { useTouch } from '../composables/useTouch'
|
|
150
184
|
import { TABS_KEY, tabsProps, type TabsExpose } from './types'
|
|
151
185
|
import { useChildren } from '../composables/useChildren'
|
|
@@ -316,23 +350,23 @@ async function updateLineStyle(animation: boolean = true) {
|
|
|
316
350
|
try {
|
|
317
351
|
const lineStyle: CSSProperties = {}
|
|
318
352
|
if (isDef(lineWidth)) {
|
|
319
|
-
lineStyle.width =
|
|
353
|
+
lineStyle.width = withDefaultUnit(lineWidth)
|
|
320
354
|
} else {
|
|
321
355
|
if (autoLineWidth) {
|
|
322
356
|
const textRects = await getRect($itemText, true, proxy)
|
|
323
357
|
const textWidth = Number(textRects[state.activeIndex].width)
|
|
324
|
-
lineStyle.width =
|
|
358
|
+
lineStyle.width = unitConvert(textWidth, 0, { output: 'px' })
|
|
325
359
|
}
|
|
326
360
|
}
|
|
327
361
|
if (isDef(lineHeight)) {
|
|
328
|
-
lineStyle.height =
|
|
329
|
-
lineStyle.borderRadius = `calc(${
|
|
362
|
+
lineStyle.height = withDefaultUnit(lineHeight)
|
|
363
|
+
lineStyle.borderRadius = `calc(${withDefaultUnit(lineHeight)} / 2)`
|
|
330
364
|
}
|
|
331
365
|
const rects = await getRect($item, true, proxy)
|
|
332
366
|
const rect = rects[state.activeIndex]
|
|
333
367
|
let left = rects.slice(0, state.activeIndex).reduce((prev, curr) => prev + Number(curr.width), 0) + Number(rect.width) / 2
|
|
334
368
|
if (left) {
|
|
335
|
-
lineStyle.transform = `translateX(${left}
|
|
369
|
+
lineStyle.transform = `translateX(${unitConvert(left, 0, { output: 'px' })}) translateX(-50%)`
|
|
336
370
|
if (animation) {
|
|
337
371
|
lineStyle.transition = 'width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);'
|
|
338
372
|
}
|
|
@@ -52,11 +52,11 @@ export const tabsProps = {
|
|
|
52
52
|
*/
|
|
53
53
|
autoLineWidth: makeBooleanProp(false),
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* 底部条宽度,支持 `px/rpx`
|
|
56
56
|
*/
|
|
57
57
|
lineWidth: numericProp,
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 底部条高度,支持 `px/rpx`
|
|
60
60
|
*/
|
|
61
61
|
lineHeight: numericProp,
|
|
62
62
|
/**
|
|
@@ -80,7 +80,19 @@ export const tabsProps = {
|
|
|
80
80
|
* 可选值:'auto' | 'always'
|
|
81
81
|
* @default auto
|
|
82
82
|
*/
|
|
83
|
-
slidable: makeStringProp<TabsSlidable>('auto')
|
|
83
|
+
slidable: makeStringProp<TabsSlidable>('auto'),
|
|
84
|
+
/**
|
|
85
|
+
* 是否开启胶囊模式
|
|
86
|
+
*/
|
|
87
|
+
pills: makeBooleanProp(false),
|
|
88
|
+
/**
|
|
89
|
+
* 胶囊背景颜色
|
|
90
|
+
*/
|
|
91
|
+
pillsColor: makeStringProp(''),
|
|
92
|
+
/**
|
|
93
|
+
* 是否开启全屏模式
|
|
94
|
+
*/
|
|
95
|
+
fullscreen: makeBooleanProp(false)
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
export type TabsExpose = {
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
background: transparent;
|
|
9
9
|
color: $normalColor;
|
|
10
10
|
border: 1px solid $normalColor;
|
|
11
|
-
padding: 0
|
|
11
|
+
padding: 0 8rpx;
|
|
12
12
|
}
|
|
13
13
|
@include when(round) {
|
|
14
14
|
line-height: 1.2;
|
|
15
15
|
font-size: $-tag-fs;
|
|
16
|
-
padding:
|
|
16
|
+
padding: 8rpx 22rpx;
|
|
17
17
|
background: transparent;
|
|
18
18
|
color: if($normalColor != $-tag-info-color, $normalColor, $-tag-round-color);
|
|
19
19
|
border: 1px solid if($normalColor != $-tag-info-color, $normalColor, $-tag-round-border-color);
|
|
20
20
|
border-radius: $-tag-round-radius;
|
|
21
21
|
}
|
|
22
22
|
@include when(mark) {
|
|
23
|
-
padding:
|
|
23
|
+
padding: 2rpx 12rpx;
|
|
24
24
|
border-radius: $-tag-mark-radius;
|
|
25
25
|
|
|
26
26
|
@include when(plain) {
|
|
27
|
-
padding: 0
|
|
27
|
+
padding: 0 12rpx;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
@include when(active) {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
font-size: $-tag-small-fs;
|
|
37
37
|
display: inline-block;
|
|
38
38
|
color: $-tag-color;
|
|
39
|
-
padding: 0
|
|
40
|
-
border-radius:
|
|
39
|
+
padding: 0 6rpx;
|
|
40
|
+
border-radius: 4rpx;
|
|
41
41
|
transition: opacity .3s;
|
|
42
42
|
vertical-align: middle;
|
|
43
43
|
line-height: initial;
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
@include when(icon) {
|
|
61
61
|
font-size: $-tag-fs;
|
|
62
62
|
line-height: 1.2;
|
|
63
|
-
padding:
|
|
63
|
+
padding: 4rpx 10rpx;
|
|
64
64
|
}
|
|
65
65
|
@include when(dynamic) {
|
|
66
66
|
box-sizing: border-box;
|
|
67
|
-
width:
|
|
67
|
+
width: 176rpx;
|
|
68
68
|
transition: .3s;
|
|
69
69
|
|
|
70
70
|
&:active {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
@include edeep(icon) {
|
|
79
79
|
display: inline-block;
|
|
80
|
-
margin-right:
|
|
80
|
+
margin-right: 8rpx;
|
|
81
81
|
font-size: $-tag-fs;
|
|
82
82
|
line-height: 1.2;
|
|
83
83
|
vertical-align: baseline;
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
vertical-align: text-top;
|
|
88
88
|
}
|
|
89
89
|
@include e(add-text) {
|
|
90
|
-
width:
|
|
91
|
-
height:
|
|
92
|
-
min-height:
|
|
90
|
+
width: 120rpx;
|
|
91
|
+
height: 28rpx;
|
|
92
|
+
min-height: 28rpx;
|
|
93
93
|
display: inline-block;
|
|
94
94
|
font-size: $-tag-fs;
|
|
95
95
|
vertical-align: middle;
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
}
|
|
98
98
|
@include e(close) {
|
|
99
99
|
display: inline-block;
|
|
100
|
-
margin-left:
|
|
101
|
-
margin-right: -
|
|
100
|
+
margin-left: 48rpx;
|
|
101
|
+
margin-right: -8rpx;
|
|
102
102
|
font-size: $-tag-close-size;
|
|
103
|
-
height:
|
|
103
|
+
height: 28rpx;
|
|
104
104
|
line-height: 1.1;
|
|
105
105
|
vertical-align: text-bottom;
|
|
106
106
|
color: $-tag-close-color;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<oxy-tooltip v-if="props.tooltip && isTextOverflow" :content="formattedText">
|
|
3
|
+
<text @click="handleClick" :class="`${rootClass} is-lines-${props.lines}`" :style="rootStyle">
|
|
4
|
+
<slot v-if="$slots.prefix || prefix" name="prefix">{{ prefix }}</slot>
|
|
5
|
+
<text>{{ formattedText }}</text>
|
|
6
|
+
<slot v-if="$slots.suffix || suffix" name="suffix">{{ suffix }}</slot>
|
|
7
|
+
</text>
|
|
8
|
+
</oxy-tooltip>
|
|
9
|
+
<text v-else :id="textId" @click="handleClick" :class="rootClass" :style="rootStyle">
|
|
3
10
|
<slot v-if="$slots.prefix || prefix" name="prefix">{{ prefix }}</slot>
|
|
4
|
-
<text>{{ formattedText }}</text>
|
|
11
|
+
<text>{{ props.toggleExpand && isTextOverflow && !expanded ? realText : formattedText }}</text>
|
|
5
12
|
<slot v-if="$slots.suffix || suffix" name="suffix">{{ suffix }}</slot>
|
|
13
|
+
<text v-if="props.toggleExpand && isTextOverflow" class="oxy-text__btn" @click.stop="handleToggle">{{ expanded ? '收起' : '展开' }}</text>
|
|
6
14
|
</text>
|
|
7
15
|
</template>
|
|
8
16
|
|
|
@@ -18,15 +26,24 @@ export default {
|
|
|
18
26
|
</script>
|
|
19
27
|
|
|
20
28
|
<script lang="ts" setup>
|
|
21
|
-
import { computed, ref, watch } from 'vue'
|
|
22
|
-
import { isDef, objToStyle } from '../common/util'
|
|
29
|
+
import { computed, ref, watch, nextTick, getCurrentInstance } from 'vue'
|
|
30
|
+
import { isDef, objToStyle, uuid, getRect } from '../common/util'
|
|
23
31
|
import { textProps } from './types'
|
|
24
32
|
import dayjs from '../../dayjs'
|
|
33
|
+
import OxyTooltip from '../oxy-tooltip/oxy-tooltip.vue'
|
|
25
34
|
|
|
26
35
|
// 获取组件的 props 和 emit 函数
|
|
27
36
|
const props = defineProps(textProps)
|
|
28
37
|
const emit = defineEmits(['click'])
|
|
29
38
|
|
|
39
|
+
const { proxy } = getCurrentInstance() as any
|
|
40
|
+
const textId = ref<string>(`oxy-text${uuid()}`)
|
|
41
|
+
const expanded = ref<boolean>(false)
|
|
42
|
+
const isTextOverflow = ref<boolean>(false)
|
|
43
|
+
const realText = ref<string>('')
|
|
44
|
+
const offset = ref<number>(0)
|
|
45
|
+
const showTooltip = ref<boolean>(false)
|
|
46
|
+
|
|
30
47
|
// 存储文本类名的响应式变量
|
|
31
48
|
const textClass = ref<string>('')
|
|
32
49
|
|
|
@@ -39,7 +56,9 @@ watch(
|
|
|
39
56
|
color: props.color,
|
|
40
57
|
bold: props.bold,
|
|
41
58
|
lines: props.lines,
|
|
42
|
-
format: props.format
|
|
59
|
+
format: props.format,
|
|
60
|
+
toggleExpand: props.toggleExpand,
|
|
61
|
+
tooltip: props.tooltip
|
|
43
62
|
}),
|
|
44
63
|
({ type }) => {
|
|
45
64
|
// 验证 type 属性
|
|
@@ -77,12 +96,12 @@ const rootStyle = computed(() => {
|
|
|
77
96
|
|
|
78
97
|
// 计算文本类名的函数
|
|
79
98
|
function computeTextClass() {
|
|
80
|
-
const { type, color, bold, lines } = props
|
|
99
|
+
const { type, color, bold, lines, toggleExpand, tooltip } = props
|
|
81
100
|
const textClassList: string[] = []
|
|
82
101
|
if (!color) {
|
|
83
102
|
textClassList.push(`is-${type}`)
|
|
84
103
|
}
|
|
85
|
-
if (isDef(lines)) {
|
|
104
|
+
if (isDef(lines) && !toggleExpand && !tooltip) {
|
|
86
105
|
textClassList.push(`is-lines-${lines}`)
|
|
87
106
|
}
|
|
88
107
|
bold && textClassList.push('is-bold')
|
|
@@ -128,6 +147,56 @@ const formattedText = computed(() => {
|
|
|
128
147
|
return formatText(`${text}`, format, mode)
|
|
129
148
|
})
|
|
130
149
|
|
|
150
|
+
watch(
|
|
151
|
+
formattedText,
|
|
152
|
+
(value) => {
|
|
153
|
+
nextTick(() => {
|
|
154
|
+
if (props.toggleExpand || props.tooltip) {
|
|
155
|
+
realText.value = value
|
|
156
|
+
offset.value = realText.value.length
|
|
157
|
+
const view = uni.createSelectorQuery().in(proxy).select(`#${textId.value}`)
|
|
158
|
+
view
|
|
159
|
+
.fields({ computedStyle: ['fontSize', 'lineHeight'] }, (res: any) => {
|
|
160
|
+
getRect(`#${textId.value}`, true, proxy)
|
|
161
|
+
.then((rects: any) => {
|
|
162
|
+
if (res && Array.isArray(rects) && rects.length && props.lines) {
|
|
163
|
+
const lines = rects[0].height / Number.parseFloat(res.lineHeight.replace('px', ''))
|
|
164
|
+
isTextOverflow.value = lines > props.lines
|
|
165
|
+
if (props.toggleExpand && isTextOverflow.value) {
|
|
166
|
+
const size = Math.floor(rects[0].width / Number.parseFloat(res.fontSize.replace('px', '')))
|
|
167
|
+
// 中英文字符长度区分
|
|
168
|
+
const length = size * props.lines - 4
|
|
169
|
+
let realOffset = 0
|
|
170
|
+
let realLength = 0
|
|
171
|
+
for (let i = 0; i < offset.value; i++) {
|
|
172
|
+
if (realText.value.charCodeAt(i) > 127) {
|
|
173
|
+
realLength += 1
|
|
174
|
+
} else {
|
|
175
|
+
realLength += 0.5
|
|
176
|
+
}
|
|
177
|
+
realOffset++
|
|
178
|
+
if (realLength >= length) {
|
|
179
|
+
offset.value = realOffset
|
|
180
|
+
break
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
realText.value = `${value.substring(0, offset.value)}...`
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
.catch(() => {})
|
|
188
|
+
})
|
|
189
|
+
.exec()
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
},
|
|
193
|
+
{ deep: true, immediate: true }
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
function handleToggle() {
|
|
197
|
+
expanded.value = !expanded.value
|
|
198
|
+
}
|
|
199
|
+
|
|
131
200
|
// 处理点击事件
|
|
132
201
|
function handleClick(event: Event) {
|
|
133
202
|
emit('click', event)
|
|
@@ -79,6 +79,18 @@ export const textProps = {
|
|
|
79
79
|
* 文本显示的行数,如果设置,超出此行数,将会显示省略号。最大值为5。
|
|
80
80
|
*/
|
|
81
81
|
lines: Number,
|
|
82
|
+
/**
|
|
83
|
+
* 文本超出,展开收起显示全部
|
|
84
|
+
* 类型:boolean
|
|
85
|
+
* 默认值:false
|
|
86
|
+
*/
|
|
87
|
+
toggleExpand: makeBooleanProp(false),
|
|
88
|
+
/**
|
|
89
|
+
* 文本超出,tooltip显示全部
|
|
90
|
+
* 类型:boolean
|
|
91
|
+
* 默认值:false
|
|
92
|
+
*/
|
|
93
|
+
tooltip: makeBooleanProp(false),
|
|
82
94
|
/**
|
|
83
95
|
* 文本行高
|
|
84
96
|
* 类型:string
|
|
@@ -144,11 +144,11 @@
|
|
|
144
144
|
box-sizing: border-box;
|
|
145
145
|
|
|
146
146
|
@include when(show-limit) {
|
|
147
|
-
padding-bottom:
|
|
147
|
+
padding-bottom: 72rpx;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
@include when(suffix) {
|
|
151
|
-
padding-right: calc($-textarea-icon-size +
|
|
151
|
+
padding-right: calc($-textarea-icon-size + 16rpx);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
border: none;
|
|
165
165
|
box-sizing: border-box;
|
|
166
166
|
word-break: break-word;
|
|
167
|
-
min-height:
|
|
167
|
+
min-height: 48rpx;
|
|
168
168
|
|
|
169
169
|
&::-webkit-input-placeholder {
|
|
170
170
|
color: $-input-placeholder-color;
|
|
@@ -198,12 +198,12 @@
|
|
|
198
198
|
|
|
199
199
|
@include e(count) {
|
|
200
200
|
position: absolute;
|
|
201
|
-
bottom:
|
|
201
|
+
bottom: 16rpx;
|
|
202
202
|
right: 0;
|
|
203
203
|
font-size: $-textarea-count-fs;
|
|
204
204
|
color: $-textarea-count-color;
|
|
205
205
|
background: $-textarea-bg;
|
|
206
|
-
line-height:
|
|
206
|
+
line-height: 40rpx;
|
|
207
207
|
display: inline-flex;
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
|
|
259
259
|
@include when(auto-height) {
|
|
260
260
|
&:not(.is-cell) {
|
|
261
|
-
padding:
|
|
261
|
+
padding: 10rpx 0;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
&::after {
|
|
@@ -31,8 +31,10 @@
|
|
|
31
31
|
:class-prefix="classPrefix"
|
|
32
32
|
:name="iconClass"
|
|
33
33
|
></oxy-icon>
|
|
34
|
-
|
|
35
|
-
<view v-if="
|
|
34
|
+
<!--文本/插槽内容-->
|
|
35
|
+
<view v-if="hasContent" class="oxy-toast__msg">
|
|
36
|
+
<slot>{{ msg }}</slot>
|
|
37
|
+
</view>
|
|
36
38
|
</view>
|
|
37
39
|
</oxy-transition>
|
|
38
40
|
</template>
|
|
@@ -54,13 +56,14 @@ import OxyLoading from '../oxy-loading/oxy-loading.vue'
|
|
|
54
56
|
import OxyOverlay from '../oxy-overlay/oxy-overlay.vue'
|
|
55
57
|
import OxyTransition from '../oxy-transition/oxy-transition.vue'
|
|
56
58
|
|
|
57
|
-
import { computed, inject, onBeforeMount, ref, watch, type CSSProperties } from 'vue'
|
|
59
|
+
import { computed, inject, onBeforeMount, ref, useSlots, watch, type CSSProperties } from 'vue'
|
|
58
60
|
import base64 from '../common/base64'
|
|
59
61
|
import { defaultOptions, getToastOptionKey, toastIcon } from '.'
|
|
60
62
|
import { toastProps, type ToastDirection, type ToastLoadingType, type ToastOptions, type ToastProps } from './types'
|
|
61
|
-
import {
|
|
63
|
+
import { withDefaultUnit, isDef, isFunction, objToStyle } from '../common/util'
|
|
62
64
|
|
|
63
65
|
const props = defineProps(toastProps)
|
|
66
|
+
const slots = useSlots()
|
|
64
67
|
const iconName = ref<string>('') // 图标类型
|
|
65
68
|
const msg = ref<string>('') // 消息内容
|
|
66
69
|
const position = ref<string>('middle')
|
|
@@ -124,10 +127,19 @@ const transitionStyle = computed(() => {
|
|
|
124
127
|
return objToStyle(style)
|
|
125
128
|
})
|
|
126
129
|
|
|
130
|
+
const hasCustomContent = computed(() => {
|
|
131
|
+
const slotNodes = slots.default?.()
|
|
132
|
+
return !!slotNodes?.length
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const hasContent = computed(() => {
|
|
136
|
+
return !!msg.value || hasCustomContent.value
|
|
137
|
+
})
|
|
138
|
+
|
|
127
139
|
const rootClass = computed(() => {
|
|
128
140
|
return `oxy-toast ${props.customClass} oxy-toast--${position.value} ${
|
|
129
|
-
(iconName.value !== 'loading' ||
|
|
130
|
-
} ${iconName.value === 'loading' && !
|
|
141
|
+
(iconName.value !== 'loading' || hasContent.value) && (iconName.value || iconClass.value) ? 'oxy-toast--with-icon' : ''
|
|
142
|
+
} ${iconName.value === 'loading' && !hasContent.value ? 'oxy-toast--loading' : ''} ${direction.value === 'vertical' ? 'is-vertical' : ''}`
|
|
131
143
|
})
|
|
132
144
|
|
|
133
145
|
const svgStyle = computed(() => {
|
|
@@ -184,8 +196,12 @@ function mergeOptionsWithProps(option: ToastOptions, props: ToastProps) {
|
|
|
184
196
|
zIndex.value = isDef(option.zIndex!) ? option.zIndex! : props.zIndex
|
|
185
197
|
loadingType.value = isDef(option.loadingType!) ? option.loadingType! : props.loadingType
|
|
186
198
|
loadingColor.value = isDef(option.loadingColor!) ? option.loadingColor! : props.loadingColor
|
|
187
|
-
iconSize.value = isDef(option.iconSize) ?
|
|
188
|
-
loadingSize.value = isDef(option.loadingSize)
|
|
199
|
+
iconSize.value = isDef(option.iconSize) ? withDefaultUnit(option.iconSize) : isDef(props.iconSize) ? withDefaultUnit(props.iconSize) : undefined
|
|
200
|
+
loadingSize.value = isDef(option.loadingSize)
|
|
201
|
+
? withDefaultUnit(option.loadingSize)
|
|
202
|
+
: isDef(props.loadingSize)
|
|
203
|
+
? withDefaultUnit(props.loadingSize)
|
|
204
|
+
: undefined
|
|
189
205
|
cover.value = isDef(option.cover!) ? option.cover! : props.cover
|
|
190
206
|
classPrefix.value = isDef(option.classPrefix) ? option.classPrefix : props.classPrefix
|
|
191
207
|
direction.value = isDef(option.direction) ? option.direction : props.direction
|