uview-plus 3.6.29 → 3.7.13
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/README.md +20 -5
- package/changelog.md +352 -0
- package/components/u-action-sheet/actionSheet.js +2 -0
- package/components/u-action-sheet/props.js +10 -0
- package/components/u-action-sheet/u-action-sheet.vue +3 -3
- package/components/u-album/album.js +1 -1
- package/components/u-avatar/avatar.js +4 -4
- package/components/u-avatar-group/avatarGroup.js +4 -4
- package/components/u-back-top/backtop.js +4 -4
- package/components/u-badge/badge.js +4 -4
- package/components/u-box/box.js +24 -0
- package/components/u-box/props.js +37 -7
- package/components/u-box/u-box.vue +29 -14
- package/components/u-button/button.js +4 -4
- package/components/u-calendar/calendar.js +4 -4
- package/components/u-canvas/u-canvas.vue +423 -0
- package/components/u-car-keyboard/carKeyboard.js +4 -4
- package/components/u-cascader/u-cascader.vue +19 -10
- package/components/u-cate-tab/u-cate-tab.vue +14 -4
- package/components/u-cell/cell.js +4 -4
- package/components/u-cell-group/cellGroup.js +4 -4
- package/components/u-checkbox/checkbox.js +4 -4
- package/components/u-checkbox-group/checkboxGroup.js +4 -4
- package/components/u-checkbox-group/u-checkbox-group.vue +4 -1
- package/components/u-circle-progress/circleProgress.js +4 -4
- package/components/u-code/code.js +3 -3
- package/components/u-code-input/codeInput.js +4 -4
- package/components/u-col/col.js +4 -4
- package/components/u-collapse/collapse.js +4 -4
- package/components/u-collapse-item/collapseItem.js +4 -4
- package/components/u-column-notice/columnNotice.js +4 -4
- package/components/u-count-down/countDown.js +4 -4
- package/components/u-count-to/countTo.js +4 -4
- package/components/u-cropper/u-cropper.vue +6 -3
- package/components/u-datetime-picker/datetimePicker.js +4 -4
- package/components/u-divider/divider.js +4 -4
- package/components/u-dragsort/u-dragsort.vue +85 -72
- package/components/u-empty/empty.js +4 -4
- package/components/u-form/form.js +4 -4
- package/components/u-form-item/formItem.js +4 -4
- package/components/u-gap/gap.js +4 -4
- package/components/u-grid/grid.js +4 -4
- package/components/u-grid/u-grid.vue +1 -1
- package/components/u-grid-item/gridItem.js +4 -4
- package/components/u-icon/icon.js +4 -4
- package/components/u-image/image.js +4 -4
- package/components/u-index-anchor/indexAnchor.js +4 -4
- package/components/u-index-list/indexList.js +4 -4
- package/components/u-input/input.js +1 -1
- package/components/u-input/u-input.vue +5 -2
- package/components/u-keyboard/keyboard.js +4 -4
- package/components/u-line/line.js +4 -4
- package/components/u-line-progress/lineProgress.js +4 -4
- package/components/u-link/link.js +4 -4
- package/components/u-list/list.js +4 -4
- package/components/u-list/u-list.vue +4 -1
- package/components/u-list-item/listItem.js +4 -4
- package/components/u-loading-icon/loadingIcon.js +4 -4
- package/components/u-loading-page/loadingPage.js +4 -4
- package/components/u-loadmore/loadmore.js +4 -4
- package/components/u-modal/modal.js +5 -5
- package/components/u-navbar/navbar.js +4 -4
- package/components/u-no-network/noNetwork.js +4 -4
- package/components/u-no-network/u-no-network.vue +7 -3
- package/components/u-notice-bar/noticeBar.js +4 -4
- package/components/u-notify/notify.js +4 -4
- package/components/u-number-box/numberBox.js +4 -4
- package/components/u-number-keyboard/numberKeyboard.js +4 -4
- package/components/u-overlay/overlay.js +4 -4
- package/components/u-parse/props.js +1 -1
- package/components/u-picker/picker.js +4 -4
- package/components/u-picker/props.js +4 -0
- package/components/u-picker/u-picker.vue +1 -1
- package/components/u-popup/popup.js +4 -4
- package/components/u-qrcode/qrcode.js +17 -67
- package/components/u-qrcode/u-qrcode.vue +179 -86
- package/components/u-radio/radio.js +4 -4
- package/components/u-radio-group/radioGroup.js +3 -3
- package/components/u-rate/rate.js +4 -4
- package/components/u-read-more/readMore.js +4 -4
- package/components/u-row/row.js +4 -4
- package/components/u-row-notice/rowNotice.js +4 -4
- package/components/u-scroll-list/scrollList.js +4 -4
- package/components/u-search/search.js +7 -5
- package/components/u-search/u-search.vue +2 -2
- package/components/u-section/section.js +4 -4
- package/components/u-select/u-select.vue +7 -1
- package/components/u-signature/u-signature.vue +138 -137
- package/components/u-skeleton/skeleton.js +4 -4
- package/components/u-slider/props.js +17 -2
- package/components/u-slider/slider.js +10 -7
- package/components/u-slider/u-slider.vue +112 -35
- package/components/u-status-bar/statusBar.js +4 -4
- package/components/u-steps/steps.js +4 -4
- package/components/u-steps/u-steps.vue +1 -1
- package/components/u-steps-item/stepsItem.js +4 -4
- package/components/u-sticky/sticky.js +4 -4
- package/components/u-subsection/subsection.js +4 -4
- package/components/u-swipe-action/swipeAction.js +4 -4
- package/components/u-swipe-action-item/swipeActionItem.js +4 -4
- package/components/u-swiper/swiper.js +4 -4
- package/components/u-swiper-indicator/swipterIndicator.js +4 -4
- package/components/u-switch/switch.js +4 -4
- package/components/u-tabbar/tabbar.js +4 -4
- package/components/u-tabbar-item/tabbarItem.js +4 -4
- package/components/u-tabs/tabs.js +4 -4
- package/components/u-tabs/u-tabs.vue +83 -95
- package/components/u-tag/tag.js +4 -4
- package/components/u-text/text.js +4 -4
- package/components/u-textarea/textarea.js +4 -4
- package/components/u-toast/toast.js +4 -4
- package/components/u-toolbar/toolbar.js +4 -4
- package/components/u-tooltip/tooltip.js +4 -4
- package/components/u-transition/transition.js +4 -4
- package/components/u-upload/upload.js +4 -4
- package/libs/css/flex.scss +2 -1
- package/libs/function/index.js +9 -4
- package/libs/util/gcanvas/bridge/bridge-weex.js +2 -1
- package/libs/util/gcanvas/env/image.js +24 -16
- package/package.json +2 -4
- package/types/comps/radio.d.ts +6 -2
- package/types/func.d.ts +317 -0
- package/types/index.d.ts +73 -105
- package/components/u-scroll-list/other.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
8
|
* @FilePath : /uview-plus/libs/config/props/code.js
|
|
9
9
|
*/
|
|
10
10
|
import { t } from '../../libs/i18n'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/codeInput.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// codeInput 组件
|
package/components/u-col/col.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/col.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// col 组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/collapse.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// collapse 组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/collapseItem.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// collapseItem 组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/columnNotice.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// columnNotice 组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/countDown.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// u-count-down 计时器组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/countTo.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// countTo 组件
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
expHeight: '',
|
|
77
77
|
// 是否允许调整裁剪框大小
|
|
78
78
|
letChangeSize: false,
|
|
79
|
-
|
|
79
|
+
// 底部安全区大小
|
|
80
|
+
safeAreaInsetsBottom: 0,
|
|
80
81
|
};
|
|
81
82
|
},
|
|
82
83
|
watch: {
|
|
@@ -151,6 +152,7 @@
|
|
|
151
152
|
this.platform = sysInfo.platform;
|
|
152
153
|
this.pixelRatio = sysInfo.pixelRatio;
|
|
153
154
|
this.windowWidth = sysInfo.windowWidth;
|
|
155
|
+
this.safeAreaInsetsBottom = sysInfo.safeAreaInsets.bottom;
|
|
154
156
|
// #ifdef H5
|
|
155
157
|
this.drawTop = sysInfo.windowTop;
|
|
156
158
|
this.windowHeight = sysInfo.windowHeight + sysInfo.windowBottom;
|
|
@@ -162,12 +164,12 @@
|
|
|
162
164
|
this.cvsStyleHeight = this.windowHeight - tabHeight + 'px';
|
|
163
165
|
} else {
|
|
164
166
|
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
165
|
-
this.cvsStyleHeight = this.windowHeight - tabHeight + 6 + 'px';
|
|
167
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight - this.safeAreaInsetsBottom + 6 + 'px';
|
|
166
168
|
}
|
|
167
169
|
// #endif
|
|
168
170
|
// #ifdef MP
|
|
169
171
|
this.windowHeight = sysInfo.windowHeight + this.moreHeight;
|
|
170
|
-
this.cvsStyleHeight = this.windowHeight - tabHeight - 2 + 'px';
|
|
172
|
+
this.cvsStyleHeight = this.windowHeight - tabHeight - this.safeAreaInsetsBottom - 2 + 'px';
|
|
171
173
|
// #endif
|
|
172
174
|
this.pxRatio = this.windowWidth/750;
|
|
173
175
|
|
|
@@ -1226,3 +1228,4 @@
|
|
|
1226
1228
|
}
|
|
1227
1229
|
}
|
|
1228
1230
|
</style>
|
|
1231
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/datetimePicker.js
|
|
9
9
|
*/
|
|
10
10
|
import { t } from '../../libs/i18n'
|
|
11
11
|
export default {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/divider.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// divider组件
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-dragsort"
|
|
3
|
-
:class="[direction == 'horizontal' ? 'u-dragsort--horizontal' : '', direction == 'vertical' ? 'u-dragsort--vertical' : '', direction == 'all' ? 'u-dragsort--all' : '']"
|
|
4
|
-
|
|
3
|
+
:class="[direction == 'horizontal' ? 'u-dragsort--horizontal' : '', direction == 'vertical' ? 'u-dragsort--vertical' : '', direction == 'all' ? 'u-dragsort--all' : '']"
|
|
4
|
+
:style="movableAreaStyle"
|
|
5
|
+
>
|
|
6
|
+
<movable-area class="u-dragsort-area">
|
|
5
7
|
<movable-view v-for="(item, index) in list" :key="item.id" :id="`u-dragsort-item-${index}`"
|
|
6
|
-
class="u-dragsort-item" :class="{ 'dragging': dragIndex === index }"
|
|
8
|
+
class="u-dragsort-item" :class="{ 'dragging': dragIndex === index, disabled: !draggable || item.draggable === false }"
|
|
7
9
|
:direction="direction === 'all' ? 'all' : direction" :x="item.x" :y="item.y" :inertia="false"
|
|
8
|
-
:disabled="!draggable ||
|
|
9
|
-
@touchstart="onTouchStart(index)" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
|
|
10
|
+
:disabled="!draggable || dragIndex === -1 || item.draggable === false" @change="onChange(index, $event)"
|
|
11
|
+
@touchstart="onTouchStart(index, $event)" @touchend="onTouchEnd" @touchcancel="onTouchEnd" @touchmove="onTouchMove">
|
|
10
12
|
<view class="u-dragsort-item-content">
|
|
13
|
+
<view
|
|
14
|
+
class="ui-dragSort-item-handler"
|
|
15
|
+
v-if="$slots.handler"
|
|
16
|
+
data-action="handler"
|
|
17
|
+
@touchstart="onTouchStart(index, $event)"
|
|
18
|
+
>
|
|
19
|
+
<slot name="handler" :item="item" :index="index"></slot>
|
|
20
|
+
</view>
|
|
11
21
|
<slot :item="item" :index="index">
|
|
12
22
|
{{ item.label }}
|
|
13
23
|
</slot>
|
|
@@ -39,6 +49,10 @@ export default {
|
|
|
39
49
|
type: Boolean,
|
|
40
50
|
default: true
|
|
41
51
|
},
|
|
52
|
+
vibrate: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
42
56
|
direction: {
|
|
43
57
|
type: String,
|
|
44
58
|
default: 'vertical',
|
|
@@ -54,11 +68,11 @@ export default {
|
|
|
54
68
|
return {
|
|
55
69
|
list: [],
|
|
56
70
|
dragIndex: -1,
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
sortChanged: false,
|
|
72
|
+
itemHeight: 0,
|
|
73
|
+
itemWidth: 0,
|
|
59
74
|
areaWidth: 0, // 可拖动区域宽度
|
|
60
75
|
areaHeight: 0, // 可拖动区域高度
|
|
61
|
-
originalPositions: [], // 保存原始位置
|
|
62
76
|
currentPosition: {
|
|
63
77
|
x: 0,
|
|
64
78
|
y: 0
|
|
@@ -69,21 +83,21 @@ export default {
|
|
|
69
83
|
movableAreaStyle() {
|
|
70
84
|
if (this.direction === 'vertical') {
|
|
71
85
|
return {
|
|
72
|
-
height: `${this.list.length * this.itemHeight}px
|
|
86
|
+
height: this.itemHeight ? `${this.list.length * this.itemHeight}px` : 'auto',
|
|
73
87
|
width: '100%'
|
|
74
|
-
}
|
|
88
|
+
}
|
|
75
89
|
} else if (this.direction === 'horizontal') {
|
|
76
90
|
return {
|
|
77
|
-
height: `${this.itemHeight}px
|
|
78
|
-
width: `${this.list.length * this.itemWidth}px`
|
|
79
|
-
}
|
|
91
|
+
height: this.itemHeight ? `${this.itemHeight}px` : 'auto',
|
|
92
|
+
width: this.itemWidth ? `${this.list.length * this.itemWidth}px` : 'auto'
|
|
93
|
+
}
|
|
80
94
|
} else {
|
|
81
95
|
// all模式,计算网格布局所需的高度
|
|
82
|
-
const rows = Math.ceil(this.list.length / this.columns)
|
|
96
|
+
const rows = Math.ceil(this.list.length / this.columns)
|
|
83
97
|
return {
|
|
84
|
-
height: `${rows * this.itemHeight}px
|
|
98
|
+
height: this.itemHeight ? `${rows * this.itemHeight}px` : 'auto',
|
|
85
99
|
width: '100%'
|
|
86
|
-
}
|
|
100
|
+
}
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
103
|
},
|
|
@@ -98,37 +112,29 @@ export default {
|
|
|
98
112
|
initList() {
|
|
99
113
|
// 初始化列表项的位置
|
|
100
114
|
this.list = this.initialList.map((item, index) => {
|
|
101
|
-
let x
|
|
115
|
+
let x
|
|
116
|
+
let y
|
|
102
117
|
|
|
103
|
-
if (this.direction === 'horizontal') {
|
|
104
|
-
x = index * this.itemWidth
|
|
105
|
-
y = 0
|
|
106
|
-
} else if (this.direction === 'vertical') {
|
|
107
|
-
x = 0
|
|
108
|
-
y = index * this.itemHeight
|
|
109
|
-
} else {
|
|
118
|
+
if (this.direction === 'horizontal' && this.itemWidth) {
|
|
119
|
+
x = index * this.itemWidth
|
|
120
|
+
y = 0
|
|
121
|
+
} else if (this.direction === 'vertical' && this.itemHeight) {
|
|
122
|
+
x = 0
|
|
123
|
+
y = index * this.itemHeight
|
|
124
|
+
} else if (this.itemWidth && this.itemHeight) {
|
|
110
125
|
// all模式,网格布局
|
|
111
|
-
const col = index % this.columns
|
|
112
|
-
const row = Math.floor(index / this.columns)
|
|
113
|
-
x = col * this.itemWidth
|
|
114
|
-
y = row * this.itemHeight
|
|
126
|
+
const col = index % this.columns
|
|
127
|
+
const row = Math.floor(index / this.columns)
|
|
128
|
+
x = col * this.itemWidth
|
|
129
|
+
y = row * this.itemHeight
|
|
115
130
|
}
|
|
116
131
|
|
|
117
132
|
return {
|
|
118
133
|
...item,
|
|
119
134
|
x,
|
|
120
135
|
y
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
// 保存初始位置
|
|
124
|
-
this.saveOriginalPositions();
|
|
125
|
-
},
|
|
126
|
-
saveOriginalPositions() {
|
|
127
|
-
// 保存当前位置作为原始位置
|
|
128
|
-
this.originalPositions = this.list.map(item => ({
|
|
129
|
-
x: item.x,
|
|
130
|
-
y: item.y
|
|
131
|
-
}));
|
|
136
|
+
}
|
|
137
|
+
})
|
|
132
138
|
},
|
|
133
139
|
async calculateItemSize() {
|
|
134
140
|
// 计算项目尺寸
|
|
@@ -144,8 +150,6 @@ export default {
|
|
|
144
150
|
|
|
145
151
|
// 更新所有项目的位置
|
|
146
152
|
this.updatePositions();
|
|
147
|
-
// 保存原始位置
|
|
148
|
-
this.saveOriginalPositions();
|
|
149
153
|
}
|
|
150
154
|
resolve(res);
|
|
151
155
|
})
|
|
@@ -169,16 +173,12 @@ export default {
|
|
|
169
173
|
.exec();
|
|
170
174
|
});
|
|
171
175
|
},
|
|
172
|
-
updatePositions() {
|
|
176
|
+
updatePositions(isDragging) {
|
|
173
177
|
// 更新所有项目的位置
|
|
174
178
|
this.list = this.list.map((item, index) => {
|
|
175
179
|
// 当前正在拖动的项目保持拖动位置不动,避免抖动
|
|
176
|
-
if (this.dragIndex === index) {
|
|
177
|
-
return
|
|
178
|
-
...item,
|
|
179
|
-
x: this.currentPosition.x,
|
|
180
|
-
y: this.currentPosition.y
|
|
181
|
-
}
|
|
180
|
+
if (isDragging && this.dragIndex === index) {
|
|
181
|
+
return item
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
if (this.direction === 'vertical') {
|
|
@@ -208,10 +208,21 @@ export default {
|
|
|
208
208
|
}
|
|
209
209
|
})
|
|
210
210
|
},
|
|
211
|
-
onTouchStart(index) {
|
|
211
|
+
onTouchStart(index, e) {
|
|
212
|
+
if (this.$slots.handler && e.currentTarget.dataset.action !== 'handler') {
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
if (this.list[index]?.draggable === false) return;
|
|
216
|
+
if (this.timer) clearTimeout(this.timer);
|
|
217
|
+
this.sortChanged = false;
|
|
212
218
|
this.dragIndex = index;
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
},
|
|
220
|
+
onTouchMove(e) {
|
|
221
|
+
if (this.dragIndex !== -1) {
|
|
222
|
+
// 目前只对H5生效, 如果该组件放置在开启了下拉刷新的scroll-view中, 向下拖动item还是会触发下拉刷新
|
|
223
|
+
e.stopPropagation()
|
|
224
|
+
e.preventDefault()
|
|
225
|
+
}
|
|
215
226
|
},
|
|
216
227
|
onChange(index, event) {
|
|
217
228
|
if (!event.detail.source || event.detail.source !== 'touch') return;
|
|
@@ -265,21 +276,22 @@ export default {
|
|
|
265
276
|
const movedItem = this.list.splice(fromIndex, 1)[0];
|
|
266
277
|
this.list.splice(toIndex, 0, movedItem);
|
|
267
278
|
|
|
268
|
-
// 震动反馈
|
|
269
|
-
if (uni.vibrateShort) {
|
|
270
|
-
uni.vibrateShort();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
279
|
// 更新当前拖拽项目的新索引
|
|
274
280
|
this.dragIndex = toIndex;
|
|
281
|
+
this.sortChanged = true;
|
|
275
282
|
|
|
276
283
|
// 更新所有项目的位置
|
|
277
|
-
this.updatePositions();
|
|
284
|
+
this.updatePositions(true);
|
|
278
285
|
|
|
279
|
-
//
|
|
280
|
-
this.
|
|
286
|
+
// 震动反馈
|
|
287
|
+
if (this.vibrate && uni.vibrateShort) {
|
|
288
|
+
uni.vibrateShort({ type: 'light' });
|
|
289
|
+
}
|
|
281
290
|
},
|
|
282
291
|
onTouchEnd() {
|
|
292
|
+
// 未发生位移
|
|
293
|
+
if (this.dragIndex === -1) return
|
|
294
|
+
|
|
283
295
|
// 0.001是为了解决拖动过快等某些极限场景下位置还原不生效问题
|
|
284
296
|
if (this.direction === 'horizontal') {
|
|
285
297
|
this.list[this.dragIndex].x = this.currentPosition.x + 0.001;
|
|
@@ -290,12 +302,14 @@ export default {
|
|
|
290
302
|
|
|
291
303
|
// 重置到位置,需要延迟触发动,否则无效。
|
|
292
304
|
sleep(50).then(() => {
|
|
293
|
-
this.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
this
|
|
305
|
+
this.updatePositions();
|
|
306
|
+
if (this.sortChanged) {
|
|
307
|
+
this.$emit('drag-end', [...this.list]);
|
|
308
|
+
this.sortChanged = false;
|
|
309
|
+
}
|
|
310
|
+
this.timer = setTimeout(() => {
|
|
311
|
+
this.dragIndex = -1
|
|
312
|
+
}, 600)
|
|
299
313
|
});
|
|
300
314
|
}
|
|
301
315
|
},
|
|
@@ -306,7 +320,7 @@ export default {
|
|
|
306
320
|
this.initList();
|
|
307
321
|
});
|
|
308
322
|
},
|
|
309
|
-
deep: true
|
|
323
|
+
// deep: true
|
|
310
324
|
},
|
|
311
325
|
direction: {
|
|
312
326
|
handler() {
|
|
@@ -323,7 +337,6 @@ export default {
|
|
|
323
337
|
this.$nextTick(() => {
|
|
324
338
|
this.initList();
|
|
325
339
|
this.updatePositions();
|
|
326
|
-
this.saveOriginalPositions();
|
|
327
340
|
});
|
|
328
341
|
}
|
|
329
342
|
}
|
|
@@ -335,15 +348,19 @@ export default {
|
|
|
335
348
|
<style scoped lang="scss">
|
|
336
349
|
.u-dragsort {
|
|
337
350
|
width: 100%;
|
|
351
|
+
height: auto;
|
|
338
352
|
|
|
339
353
|
.u-dragsort-area {
|
|
340
354
|
width: 100%;
|
|
355
|
+
height: 100%;
|
|
341
356
|
position: relative;
|
|
342
357
|
}
|
|
343
358
|
|
|
344
359
|
.u-dragsort-item {
|
|
345
360
|
position: absolute;
|
|
346
361
|
width: 100%;
|
|
362
|
+
transition: box-shadow 0.45s ease-out;
|
|
363
|
+
cursor: pointer;
|
|
347
364
|
|
|
348
365
|
&.dragging {
|
|
349
366
|
z-index: 1000;
|
|
@@ -351,6 +368,7 @@ export default {
|
|
|
351
368
|
}
|
|
352
369
|
|
|
353
370
|
.u-dragsort-item-content {
|
|
371
|
+
position: relative;
|
|
354
372
|
padding: 0;
|
|
355
373
|
box-sizing: border-box;
|
|
356
374
|
}
|
|
@@ -366,7 +384,6 @@ export default {
|
|
|
366
384
|
.u-dragsort-area {
|
|
367
385
|
display: flex;
|
|
368
386
|
white-space: nowrap;
|
|
369
|
-
height: auto;
|
|
370
387
|
}
|
|
371
388
|
|
|
372
389
|
.u-dragsort-item {
|
|
@@ -376,10 +393,6 @@ export default {
|
|
|
376
393
|
}
|
|
377
394
|
|
|
378
395
|
&.u-dragsort--all {
|
|
379
|
-
.u-dragsort-area {
|
|
380
|
-
height: auto;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
396
|
.u-dragsort-item {
|
|
384
397
|
width: auto;
|
|
385
398
|
height: auto;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/empty.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// empty组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/form.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// form 组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/formItem.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// formItem 组件
|
package/components/u-gap/gap.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/gap.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// gap组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/grid.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// grid组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/gridItem.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// grid-item组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/icon.js
|
|
9
9
|
*/
|
|
10
10
|
import config from '../../libs/config/config'
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/image.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// image组件
|