uview-plus 3.3.20 → 3.3.21
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/changelog.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-qrcode">
|
|
3
|
-
<
|
|
4
|
-
|
|
2
|
+
<view class="u-qrcode" @longpress="longpress">
|
|
3
|
+
<view class="u-qrcode__content" @click="preview">
|
|
4
|
+
<canvas class="u-qrcode__canvas"
|
|
5
|
+
:id="cid" :canvas-id="cid" :style="{ width: size + unit, height: size + unit }" />
|
|
6
|
+
<view v-if="showLoading && loading" class="u-qrcode__loading"
|
|
7
|
+
:style="{ width: size + unit, height: size + unit }">
|
|
8
|
+
<up-loading-icon vertical :text="loadingText" textSize="14px"></up-loading-icon>
|
|
9
|
+
</view>
|
|
10
|
+
<!-- <image v-show="show" :src="result" :style="{ width: size + unit, height: size + unit }" /> -->
|
|
11
|
+
</view>
|
|
12
|
+
<!-- <up-action-sheet :actions="list" cancelText="取消"
|
|
13
|
+
v-model:show="popupShow" @select="selectClick">
|
|
14
|
+
</up-action-sheet> -->
|
|
5
15
|
</view>
|
|
6
16
|
</template>
|
|
7
17
|
|
|
@@ -73,23 +83,32 @@ export default {
|
|
|
73
83
|
},
|
|
74
84
|
loadingText: {
|
|
75
85
|
type: String,
|
|
76
|
-
default: '
|
|
86
|
+
default: '生成中'
|
|
77
87
|
},
|
|
78
88
|
},
|
|
89
|
+
emits: ['result', 'longpress'],
|
|
79
90
|
data() {
|
|
80
91
|
return {
|
|
92
|
+
loading: false,
|
|
81
93
|
result: '',
|
|
94
|
+
popupShow: false,
|
|
95
|
+
list: [
|
|
96
|
+
{
|
|
97
|
+
name: '保存二维码',
|
|
98
|
+
}
|
|
99
|
+
]
|
|
82
100
|
}
|
|
83
101
|
},
|
|
84
102
|
methods: {
|
|
85
103
|
_makeCode() {
|
|
86
104
|
let that = this
|
|
87
105
|
if (!this._empty(this.val)) {
|
|
106
|
+
this.loading = true
|
|
88
107
|
qrcode = new QRCode({
|
|
89
108
|
context: that, // 上下文环境
|
|
90
109
|
canvasId: that.cid, // canvas-id
|
|
91
110
|
usingComponents: that.usingComponents, // 是否是自定义组件
|
|
92
|
-
showLoading:
|
|
111
|
+
showLoading: false, // 是否显示loading
|
|
93
112
|
loadingText: that.loadingText, // loading文字
|
|
94
113
|
text: that.val, // 生成内容
|
|
95
114
|
size: that.size, // 二维码大小
|
|
@@ -130,9 +149,42 @@ export default {
|
|
|
130
149
|
});
|
|
131
150
|
}
|
|
132
151
|
},
|
|
152
|
+
preview() {
|
|
153
|
+
// 预览图片
|
|
154
|
+
console.log(this.result)
|
|
155
|
+
uni.previewImage({
|
|
156
|
+
urls: [this.result],
|
|
157
|
+
longPressActions: {
|
|
158
|
+
itemList: ['保存二维码图片'],
|
|
159
|
+
success: function(data) {
|
|
160
|
+
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
|
161
|
+
switch (data.tapIndex) {
|
|
162
|
+
case 0:
|
|
163
|
+
that._saveCode();
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
fail: function(err) {
|
|
168
|
+
console.log(err.errMsg);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
longpress() {
|
|
174
|
+
this.$emit('longpress', this.result)
|
|
175
|
+
},
|
|
176
|
+
selectClick(index) {
|
|
177
|
+
switch (index) {
|
|
178
|
+
case 0:
|
|
179
|
+
alert('保存二维码')
|
|
180
|
+
this._saveCode();
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
133
184
|
_result(res) {
|
|
185
|
+
this.loading = false;
|
|
134
186
|
this.result = res;
|
|
135
|
-
this.$emit('result', res)
|
|
187
|
+
this.$emit('result', res);
|
|
136
188
|
},
|
|
137
189
|
_empty(v) {
|
|
138
190
|
let tp = typeof v,
|
|
@@ -187,13 +239,26 @@ export default {
|
|
|
187
239
|
</script>
|
|
188
240
|
<style lang="scss" scoped>
|
|
189
241
|
.u-qrcode {
|
|
190
|
-
|
|
242
|
+
&__loading {
|
|
243
|
+
display: flex;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
align-items: center;
|
|
246
|
+
background-color: #f7f7f7;
|
|
247
|
+
position: absolute;
|
|
248
|
+
top: 0;
|
|
249
|
+
bottom: 0;
|
|
250
|
+
left: 0;
|
|
251
|
+
right: 0;
|
|
252
|
+
}
|
|
253
|
+
&__content {
|
|
254
|
+
position: relative;
|
|
191
255
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
256
|
+
&__canvas {
|
|
257
|
+
position: fixed;
|
|
258
|
+
top: -99999rpx;
|
|
259
|
+
left: -99999rpx;
|
|
260
|
+
z-index: -99999;
|
|
261
|
+
}
|
|
197
262
|
}
|
|
198
263
|
}
|
|
199
264
|
</style>
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
if (this.disabled) return
|
|
15
15
|
// 打开或关闭单元格
|
|
16
16
|
if (newValue === 'close' && this.status === 'open') {
|
|
17
|
-
this.closeSwipeAction(
|
|
17
|
+
this.closeSwipeAction()
|
|
18
18
|
} else if(newValue === 'open' && this.status === 'close') {
|
|
19
19
|
this.openSwipeAction()
|
|
20
20
|
}
|
|
@@ -28,7 +28,13 @@ export default {
|
|
|
28
28
|
},
|
|
29
29
|
methods: {
|
|
30
30
|
clickHandler() {
|
|
31
|
-
},
|
|
31
|
+
},
|
|
32
|
+
closeHandler() {
|
|
33
|
+
this.closeSwipeAction()
|
|
34
|
+
},
|
|
35
|
+
setStatus(status) {
|
|
36
|
+
this.status = status
|
|
37
|
+
},
|
|
32
38
|
getBtnWidth() {
|
|
33
39
|
let view = uni.createSelectorQuery().in(this).select(".u-swipe-action-item__right");
|
|
34
40
|
view.fields({
|
|
@@ -49,8 +55,9 @@ export default {
|
|
|
49
55
|
this.state.startX = touches[0].pageX
|
|
50
56
|
this.state.startY = touches[0].pageY
|
|
51
57
|
|
|
52
|
-
//
|
|
53
|
-
//
|
|
58
|
+
// 关闭其它
|
|
59
|
+
// console.log(this.parent)
|
|
60
|
+
this.parent && this.parent.closeOther(this)
|
|
54
61
|
},
|
|
55
62
|
touchmove(event) {
|
|
56
63
|
// console.log(event)
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
// #ifdef APP-NVUE
|
|
102
102
|
nvue,
|
|
103
103
|
// #endif
|
|
104
|
-
// #ifdef APP-VUE || MP-WEIXIN ||
|
|
104
|
+
// #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5
|
|
105
105
|
wxs,
|
|
106
106
|
// #endif
|
|
107
107
|
// #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO
|
|
@@ -138,6 +138,9 @@
|
|
|
138
138
|
mounted() {
|
|
139
139
|
this.init()
|
|
140
140
|
},
|
|
141
|
+
beforeUmount() {
|
|
142
|
+
this.closeHandler()
|
|
143
|
+
},
|
|
141
144
|
methods: {
|
|
142
145
|
addUnit,
|
|
143
146
|
getPx,
|