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,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/calendar.js
|
|
9
9
|
*/
|
|
10
10
|
import { t } from '../../libs/i18n'
|
|
11
11
|
export default {
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-canvas"
|
|
3
|
+
:id="rootId"
|
|
4
|
+
:style="{
|
|
5
|
+
width: useRootHeightAndWidth ? '100%' : 'auto',
|
|
6
|
+
height: useRootHeightAndWidth ? '100%' : 'auto',
|
|
7
|
+
}">
|
|
8
|
+
<!-- #ifdef MP || H5 -->
|
|
9
|
+
<canvas
|
|
10
|
+
class="u-canvas__canvas"
|
|
11
|
+
:id="canvasId"
|
|
12
|
+
:canvas-id="canvasId"
|
|
13
|
+
type="2d"
|
|
14
|
+
:style="{ width: width + unit, height: height + unit }"
|
|
15
|
+
@touchstart="onTouchStart"
|
|
16
|
+
@touchmove="onTouchMove"
|
|
17
|
+
@touchend="onTouchEnd"/>
|
|
18
|
+
<!-- #endif -->
|
|
19
|
+
|
|
20
|
+
<!-- #ifdef APP-PLUS -->
|
|
21
|
+
<canvas
|
|
22
|
+
class="u-canvas__canvas"
|
|
23
|
+
:id="canvasId"
|
|
24
|
+
:canvas-id="canvasId"
|
|
25
|
+
:style="{ width: width + unit, height: height + unit }"
|
|
26
|
+
@touchstart="onTouchStart"
|
|
27
|
+
@touchmove="onTouchMove"
|
|
28
|
+
@touchend="onTouchEnd"/>
|
|
29
|
+
<!-- #endif -->
|
|
30
|
+
|
|
31
|
+
<!-- #ifdef APP-NVUE -->
|
|
32
|
+
<gcanvas class="u-canvas__canvas" ref="gcanvess"
|
|
33
|
+
:style="{ width: width + unit, height: height + unit }"
|
|
34
|
+
@touchstart="onTouchStart"
|
|
35
|
+
@touchmove="onTouchMove"
|
|
36
|
+
@touchend="onTouchEnd">
|
|
37
|
+
</gcanvas>
|
|
38
|
+
<!-- #endif -->
|
|
39
|
+
</view>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
// #ifdef APP-NVUE
|
|
44
|
+
// https://github.com/dcloudio/NvueCanvasDemo/blob/master/README.md
|
|
45
|
+
import {
|
|
46
|
+
enable,
|
|
47
|
+
WeexBridge,
|
|
48
|
+
Image as GImage
|
|
49
|
+
} from '../../libs/util/gcanvas/index.js';
|
|
50
|
+
// #endif
|
|
51
|
+
let canvasNode = null;
|
|
52
|
+
export default {
|
|
53
|
+
name: "u-canvas",
|
|
54
|
+
props: {
|
|
55
|
+
canvasId: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: () => {
|
|
58
|
+
return `u-canvas${Math.floor(Math.random() * 1000000)}`
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
width: {
|
|
62
|
+
type: [String, Number],
|
|
63
|
+
default: 300
|
|
64
|
+
},
|
|
65
|
+
height: {
|
|
66
|
+
type: [String, Number],
|
|
67
|
+
default: 300
|
|
68
|
+
},
|
|
69
|
+
unit: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: 'px'
|
|
72
|
+
},
|
|
73
|
+
useRootHeightAndWidth: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
// 背景色
|
|
78
|
+
bgColor: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: '#ffffff'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
rootId: `rootId${Number(Math.random() * 100).toFixed(0)}`,
|
|
86
|
+
ganvas: null,
|
|
87
|
+
canvasContext: null,
|
|
88
|
+
widthLocal: this.width,
|
|
89
|
+
heightLocal: this.height,
|
|
90
|
+
ctx: null
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
// 计算实际画布尺寸
|
|
95
|
+
actualWidth() {
|
|
96
|
+
return this.useRootHeightAndWidth ? this.widthLocal : Number(this.width);
|
|
97
|
+
},
|
|
98
|
+
actualHeight() {
|
|
99
|
+
return this.useRootHeightAndWidth ? this.heightLocal : Number(this.height);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
// 添加触摸事件处理方法
|
|
104
|
+
onTouchStart(e) {
|
|
105
|
+
this.$emit('touchstart', e);
|
|
106
|
+
},
|
|
107
|
+
onTouchMove(e) {
|
|
108
|
+
this.$emit('touchmove', e);
|
|
109
|
+
},
|
|
110
|
+
onTouchEnd(e) {
|
|
111
|
+
this.$emit('touchend', e);
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 获取节点
|
|
116
|
+
* @param id 节点id
|
|
117
|
+
* @param isCanvas 是否为Canvas节点
|
|
118
|
+
* @return {Promise<unknown>}
|
|
119
|
+
*/
|
|
120
|
+
async getCanvasNode(id, isCanvas = true) {
|
|
121
|
+
let that = this
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
try {
|
|
124
|
+
// #ifdef APP-NVUE
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
/*获取元素引用*/
|
|
127
|
+
this.ganvas = this.$refs["gcanvess"]
|
|
128
|
+
/*通过元素引用获取canvas对象*/
|
|
129
|
+
let canvasNode = enable(this.ganvas, {
|
|
130
|
+
bridge: WeexBridge
|
|
131
|
+
})
|
|
132
|
+
resolve(canvasNode)
|
|
133
|
+
}, 200)
|
|
134
|
+
// #endif
|
|
135
|
+
// #ifndef APP-PLUS-NVUE
|
|
136
|
+
const query = uni.createSelectorQuery().in(that).select(`#${id}`);
|
|
137
|
+
query.fields({
|
|
138
|
+
node: true,
|
|
139
|
+
size: true
|
|
140
|
+
})
|
|
141
|
+
.exec((res) => {
|
|
142
|
+
if (isCanvas) {
|
|
143
|
+
if (res[0]?.node) {
|
|
144
|
+
resolve(res[0].node)
|
|
145
|
+
} else {
|
|
146
|
+
resolve(false)
|
|
147
|
+
console.error("获取节点出错", res)
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
resolve(res[0])
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
// #endif
|
|
154
|
+
} catch (e) {
|
|
155
|
+
console.error("获取节点失败", e)
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 获取Canvas上下文
|
|
162
|
+
*/
|
|
163
|
+
getCanvasContext() {
|
|
164
|
+
// #ifdef APP-PLUS
|
|
165
|
+
return uni.createCanvasContext(this.canvasId, this);
|
|
166
|
+
// #endif
|
|
167
|
+
// #ifdef APP-PLUS-NVUE || MP || H5
|
|
168
|
+
return canvasNode.getContext('2d');
|
|
169
|
+
// #endif
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 初始化Canvas
|
|
174
|
+
*/
|
|
175
|
+
async initCanvas() {
|
|
176
|
+
try {
|
|
177
|
+
canvasNode = await this.getCanvasNode(this.canvasId);
|
|
178
|
+
|
|
179
|
+
// #ifdef MP-WEIXIN
|
|
180
|
+
// 在微信小程序中,为了提高清晰度,需要考虑设备像素比
|
|
181
|
+
const dpr = uni.getSystemInfoSync().pixelRatio;
|
|
182
|
+
if(canvasNode) {
|
|
183
|
+
// 设置canvas实际绘制尺寸为显示尺寸的dpr倍
|
|
184
|
+
canvasNode.width = this.actualWidth * dpr;
|
|
185
|
+
canvasNode.height = this.actualHeight * dpr;
|
|
186
|
+
}
|
|
187
|
+
// #endif
|
|
188
|
+
|
|
189
|
+
this.ctx = this.getCanvasContext();
|
|
190
|
+
|
|
191
|
+
// #ifdef MP-WEIXIN
|
|
192
|
+
if(this.ctx) {
|
|
193
|
+
this.ctx.scale(dpr, dpr);
|
|
194
|
+
}
|
|
195
|
+
// #endif
|
|
196
|
+
|
|
197
|
+
// 初始化背景,但不在微信小程序中调用draw
|
|
198
|
+
this.clearCanvas();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
console.error("初始化Canvas失败:", error);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 清空画布
|
|
206
|
+
*/
|
|
207
|
+
clearCanvas() {
|
|
208
|
+
if (!this.ctx) return;
|
|
209
|
+
|
|
210
|
+
this.clearRect(0, 0, this.actualWidth, this.actualHeight);
|
|
211
|
+
|
|
212
|
+
// 填充背景色
|
|
213
|
+
this.beginPath();
|
|
214
|
+
this.rect(0, 0, this.actualWidth, this.actualHeight);
|
|
215
|
+
|
|
216
|
+
this.setFillStyle(this.bgColor);
|
|
217
|
+
this.fill();
|
|
218
|
+
|
|
219
|
+
this.draw();
|
|
220
|
+
},
|
|
221
|
+
rect(x, y, width, height) {
|
|
222
|
+
if (!this.ctx) return;
|
|
223
|
+
this.ctx.rect(x, y, width, height);
|
|
224
|
+
},
|
|
225
|
+
clearRect(x, y, width, height) {
|
|
226
|
+
if (!this.ctx) return;
|
|
227
|
+
this.ctx.clearRect(x, y, width, height);
|
|
228
|
+
},
|
|
229
|
+
fill() {
|
|
230
|
+
if (!this.ctx) return;
|
|
231
|
+
this.ctx.fill();
|
|
232
|
+
},
|
|
233
|
+
setFillStyle(color) {
|
|
234
|
+
if (!this.ctx) return;
|
|
235
|
+
|
|
236
|
+
// #ifndef APP-PLUS-NVUE
|
|
237
|
+
if (this.ctx.setFillStyle) {
|
|
238
|
+
this.ctx.setFillStyle(color);
|
|
239
|
+
} else {
|
|
240
|
+
this.ctx.fillStyle = color;
|
|
241
|
+
}
|
|
242
|
+
// #endif
|
|
243
|
+
// #ifdef APP-PLUS-NVUE
|
|
244
|
+
this.ctx.setFillStyle(color);
|
|
245
|
+
// #endif
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 设置线条样式
|
|
250
|
+
*/
|
|
251
|
+
setLineStyle(lineColor, lineWidth) {
|
|
252
|
+
if (!this.ctx) return;
|
|
253
|
+
this.setLineCap('round');
|
|
254
|
+
this.setLineJoin('round');
|
|
255
|
+
this.setStrokeStyle(lineColor);
|
|
256
|
+
this.setLineWidth(lineWidth);
|
|
257
|
+
},
|
|
258
|
+
setLineCap(lineCap = 'round') {
|
|
259
|
+
if (!this.ctx) return;
|
|
260
|
+
if (this.ctx.setLineCap) {
|
|
261
|
+
this.ctx.setLineCap(lineCap);
|
|
262
|
+
} else {
|
|
263
|
+
this.ctx.lineCap = lineCap;
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
setLineJoin(lineJoin = 'round') {
|
|
267
|
+
if (!this.ctx) return;
|
|
268
|
+
if (this.ctx.setLineJoin) {
|
|
269
|
+
this.ctx.setLineJoin(lineJoin);
|
|
270
|
+
} else {
|
|
271
|
+
this.ctx.lineJoin = lineJoin;
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
setStrokeStyle(color) {
|
|
275
|
+
if (!this.ctx) return;
|
|
276
|
+
if (this.ctx.setStrokeStyle) {
|
|
277
|
+
this.ctx.setStrokeStyle(color);
|
|
278
|
+
} else {
|
|
279
|
+
this.ctx.strokeStyle = color;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
setLineWidth(width) {
|
|
283
|
+
if (!this.ctx) return;
|
|
284
|
+
if (this.ctx.setLineWidth) {
|
|
285
|
+
this.ctx.setLineWidth(width);
|
|
286
|
+
} else {
|
|
287
|
+
this.ctx.lineWidth = width;
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 开始路径
|
|
293
|
+
*/
|
|
294
|
+
beginPath() {
|
|
295
|
+
if (!this.ctx) return;
|
|
296
|
+
this.ctx.beginPath();
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 移动到某点
|
|
301
|
+
*/
|
|
302
|
+
moveTo(x, y) {
|
|
303
|
+
if (!this.ctx) return;
|
|
304
|
+
this.ctx.moveTo(x, y);
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 画线到某点
|
|
309
|
+
*/
|
|
310
|
+
lineTo(x, y) {
|
|
311
|
+
if (!this.ctx) return;
|
|
312
|
+
this.ctx.lineTo(x, y);
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* 描边
|
|
317
|
+
*/
|
|
318
|
+
stroke() {
|
|
319
|
+
if (!this.ctx) return;
|
|
320
|
+
this.ctx.stroke();
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* 关闭路径
|
|
325
|
+
*/
|
|
326
|
+
closePath() {
|
|
327
|
+
if (!this.ctx) return;
|
|
328
|
+
this.ctx.closePath();
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* 绘制操作
|
|
333
|
+
*/
|
|
334
|
+
draw(isLastDraw = false) {
|
|
335
|
+
// #ifndef MP-WEIXIN
|
|
336
|
+
if (this.ctx && typeof this.ctx.draw === 'function') {
|
|
337
|
+
this.ctx.draw(isLastDraw);
|
|
338
|
+
}
|
|
339
|
+
// #endif
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* 导出图片
|
|
344
|
+
*/
|
|
345
|
+
exportImage(fileType = 'png', quality = 1) {
|
|
346
|
+
return new Promise((resolve, reject) => {
|
|
347
|
+
// #ifdef MP-WEIXIN
|
|
348
|
+
// 微信小程序中需要先完成绘制,然后导出图片
|
|
349
|
+
setTimeout(() => {
|
|
350
|
+
uni.canvasToTempFilePath({
|
|
351
|
+
x: 0,
|
|
352
|
+
y: 0,
|
|
353
|
+
width: this.actualWidth,
|
|
354
|
+
height: this.actualHeight,
|
|
355
|
+
destWidth: this.actualWidth * 2, // 使用双倍尺寸以提高清晰度
|
|
356
|
+
destHeight: this.actualHeight * 2,
|
|
357
|
+
canvas: canvasNode, // 2d必须
|
|
358
|
+
canvasId: this.canvasId,
|
|
359
|
+
fileType: fileType,
|
|
360
|
+
quality: quality,
|
|
361
|
+
success: (res) => {
|
|
362
|
+
resolve(res.tempFilePath);
|
|
363
|
+
},
|
|
364
|
+
fail: (err) => {
|
|
365
|
+
console.error('导出图片失败:', err);
|
|
366
|
+
reject(err);
|
|
367
|
+
}
|
|
368
|
+
}, this);
|
|
369
|
+
}, 50); // 等待50毫秒确保绘制完成
|
|
370
|
+
// #endif
|
|
371
|
+
|
|
372
|
+
// #ifndef MP-WEIXIN
|
|
373
|
+
uni.canvasToTempFilePath({
|
|
374
|
+
canvas: canvasNode, // 2d必须
|
|
375
|
+
canvasId: this.canvasId,
|
|
376
|
+
fileType: fileType,
|
|
377
|
+
quality: quality,
|
|
378
|
+
success: (res) => {
|
|
379
|
+
resolve(res.tempFilePath);
|
|
380
|
+
},
|
|
381
|
+
fail: (err) => {
|
|
382
|
+
console.error('导出图片失败:', err);
|
|
383
|
+
reject(err);
|
|
384
|
+
}
|
|
385
|
+
}, this);
|
|
386
|
+
// #endif
|
|
387
|
+
});
|
|
388
|
+
},
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* 使用根节点宽高 设置新的size
|
|
392
|
+
* @return {Promise<void>}
|
|
393
|
+
*/
|
|
394
|
+
async setNewSize(){
|
|
395
|
+
const rootNode = await this.getCanvasNode(this.rootId, false);
|
|
396
|
+
const { width , height } = rootNode;
|
|
397
|
+
this.widthLocal = height;
|
|
398
|
+
this.heightLocal = width;
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
async mounted() {
|
|
403
|
+
// 如果使用根节点的宽高 则 重新设置 size
|
|
404
|
+
if(this.useRootHeightAndWidth){
|
|
405
|
+
await this.setNewSize();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// 初始化Canvas
|
|
409
|
+
await this.initCanvas();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
</script>
|
|
413
|
+
|
|
414
|
+
<style lang="scss" scoped>
|
|
415
|
+
.u-canvas {
|
|
416
|
+
position: relative;
|
|
417
|
+
overflow: hidden;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.u-canvas__canvas {
|
|
421
|
+
display: block;
|
|
422
|
+
}
|
|
423
|
+
</style>
|
|
@@ -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/carKeyboard.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// 车牌号键盘
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<up-popup :show="popupShow" mode="bottom" :popup="false"
|
|
3
|
-
:mask="true" :closeable="
|
|
3
|
+
:mask="true" :closeable="closeable" :safe-area-inset-bottom="true"
|
|
4
4
|
close-icon-color="#ffffff" :z-index="uZIndex"
|
|
5
5
|
:maskCloseAble="maskCloseAble" @close="close">
|
|
6
6
|
<view class="up-p-t-30 up-p-l-20 up-m-b-10" v-if="headerDirection =='column'">
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
* @property {String} labelKey 指定选项标签为选项对象中的哪个属性值
|
|
62
62
|
* @property {String} childrenKey 指定选项的子选项为选项对象中的哪个属性值
|
|
63
63
|
* @property {Boolean} autoClose 是否在选择最后一级时自动关闭并触发confirm(默认false)
|
|
64
|
+
* @property {Boolean} closeable 是否显示关闭图标(默认true)
|
|
64
65
|
*/
|
|
65
66
|
import { t } from '../../libs/i18n'
|
|
66
67
|
export default {
|
|
@@ -124,6 +125,11 @@
|
|
|
124
125
|
optionsCols: {
|
|
125
126
|
type: [Number],
|
|
126
127
|
default: 2
|
|
128
|
+
},
|
|
129
|
+
// 是否显示关闭图标
|
|
130
|
+
closeable: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: true
|
|
127
133
|
}
|
|
128
134
|
},
|
|
129
135
|
data() {
|
|
@@ -142,6 +148,7 @@
|
|
|
142
148
|
data: {
|
|
143
149
|
handler() {
|
|
144
150
|
this.initLevelList();
|
|
151
|
+
this.setDefaultValue();
|
|
145
152
|
},
|
|
146
153
|
immediate: true
|
|
147
154
|
},
|
|
@@ -150,7 +157,8 @@
|
|
|
150
157
|
},
|
|
151
158
|
modelValue: {
|
|
152
159
|
handler() {
|
|
153
|
-
|
|
160
|
+
// 初始化选中值
|
|
161
|
+
this.setDefaultValue();
|
|
154
162
|
},
|
|
155
163
|
immediate: true
|
|
156
164
|
}
|
|
@@ -192,15 +200,9 @@
|
|
|
192
200
|
}
|
|
193
201
|
},
|
|
194
202
|
// 新增confirm事件
|
|
195
|
-
emits: ['update:modelValue', 'change', 'confirm'],
|
|
203
|
+
emits: ['update:modelValue', 'update:show', 'change', 'confirm', 'cancel'],
|
|
196
204
|
methods: {
|
|
197
205
|
t,
|
|
198
|
-
init() {
|
|
199
|
-
// 初始化选中值
|
|
200
|
-
if (this.modelValue && this.modelValue.length > 0) {
|
|
201
|
-
this.setDefaultValue();
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
206
|
initLevelList() {
|
|
205
207
|
// 初始化第一级数据
|
|
206
208
|
if (this.data && this.data.length > 0) {
|
|
@@ -209,14 +211,20 @@
|
|
|
209
211
|
}
|
|
210
212
|
},
|
|
211
213
|
setDefaultValue() {
|
|
214
|
+
// 检查data是否为空
|
|
215
|
+
if (!this.data || this.data.length == 0) return;
|
|
216
|
+
// 检查modelValue是否为空
|
|
217
|
+
if (!this.modelValue || this.modelValue.length == 0) return;
|
|
212
218
|
// 根据默认值设置选中项
|
|
213
219
|
// 根据modelValue获取indexs给selectedValueIndexs
|
|
214
220
|
this.selectedValueIndexs = [];
|
|
221
|
+
this.levelList = []; // 设置层级数据为空
|
|
215
222
|
let currentLevelData = this.data;
|
|
216
223
|
|
|
217
224
|
for (let i = 0; i < this.modelValue.length; i++) {
|
|
218
225
|
const value = this.modelValue[i];
|
|
219
226
|
const index = currentLevelData.findIndex(item => item[this.valueKey] === value);
|
|
227
|
+
this.levelList[i] = currentLevelData; // 设置每一层级的数据
|
|
220
228
|
|
|
221
229
|
if (index !== -1) {
|
|
222
230
|
this.selectedValueIndexs.push(index);
|
|
@@ -234,6 +242,7 @@
|
|
|
234
242
|
}
|
|
235
243
|
},
|
|
236
244
|
close() {
|
|
245
|
+
this.$emit('cancel');
|
|
237
246
|
this.$emit('update:show', false);
|
|
238
247
|
},
|
|
239
248
|
tabsChange(item) {
|
|
@@ -332,4 +341,4 @@
|
|
|
332
341
|
.u-cascader-action {
|
|
333
342
|
border-top: 1px solid #eee;
|
|
334
343
|
}
|
|
335
|
-
</style>
|
|
344
|
+
</style>
|
|
@@ -83,14 +83,18 @@
|
|
|
83
83
|
deep: true,
|
|
84
84
|
handler(newVal, oldVal) {
|
|
85
85
|
// this.observer();
|
|
86
|
-
sleep(30)
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
sleep(30).then(() => {
|
|
87
|
+
this.getMenuItemTop();
|
|
88
|
+
this.leftMenuStatus(this.innerCurrent);
|
|
89
|
+
})
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
92
|
current(nval) {
|
|
92
93
|
this.innerCurrent = nval;
|
|
93
94
|
this.leftMenuStatus(this.innerCurrent);
|
|
95
|
+
sleep(30).then(() => {
|
|
96
|
+
this.swichMenu(this.innerCurrent)
|
|
97
|
+
})
|
|
94
98
|
},
|
|
95
99
|
height() {
|
|
96
100
|
// console.log('height change');
|
|
@@ -120,6 +124,10 @@
|
|
|
120
124
|
this.innerCurrent = this.current;
|
|
121
125
|
this.leftMenuStatus(this.innerCurrent);
|
|
122
126
|
this.getMenuItemTop()
|
|
127
|
+
// 设置默认index
|
|
128
|
+
sleep(50).then(() => {
|
|
129
|
+
this.swichMenu(this.innerCurrent)
|
|
130
|
+
})
|
|
123
131
|
},
|
|
124
132
|
methods: {
|
|
125
133
|
addUnit,
|
|
@@ -129,7 +137,9 @@
|
|
|
129
137
|
if(this.arr.length == 0) {
|
|
130
138
|
await this.getMenuItemTop();
|
|
131
139
|
}
|
|
132
|
-
this.scrollIntoView
|
|
140
|
+
if (this.scrollIntoView != 'item' + index) {
|
|
141
|
+
this.scrollIntoView = 'item' + index;
|
|
142
|
+
}
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
if (index == this.innerCurrent) return;
|
|
@@ -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/cell.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// cell组件的props
|
|
@@ -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/cellGroup.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// cell-group组件的props
|
|
@@ -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/checkbox.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// checkbox组件
|
|
@@ -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/checkboxGroup.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// checkbox-group组件
|
|
@@ -109,7 +109,10 @@
|
|
|
109
109
|
this.$emit("input", values);
|
|
110
110
|
// #endif
|
|
111
111
|
// 放在最后更新,否则change事件传出去的values不会更新
|
|
112
|
-
this.$emit('change', values
|
|
112
|
+
this.$emit('change', values, {
|
|
113
|
+
isChecked: childInstance.$data['isChecked'],
|
|
114
|
+
name: childInstance.$props['name'] // 当前变动的checkbox的name值
|
|
115
|
+
})
|
|
113
116
|
},
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -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/circleProgress.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// circleProgress 组件
|