uview-plus 3.1.49 → 3.1.51
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 +5 -0
- package/components/u-button/vue.scss +8 -7
- package/components/u-datetime-picker/props.js +1 -1
- package/components/u-datetime-picker/u-datetime-picker.vue +38 -2
- package/components/u-qrcode/qrcode.js +1206 -0
- package/components/u-qrcode/u-qrcode.vue +199 -0
- package/components/u-subsection/u-subsection.vue +2 -2
- package/components/u-tooltip/u-tooltip.vue +0 -28
- package/package.json +3 -2
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-qrcode">
|
|
3
|
+
<canvas class="u-qrcode__canvas" :canvas-id="cid" :style="{ width: size + unit, height: size + unit }" />
|
|
4
|
+
<image v-show="show" :src="result" :style="{ width: size + unit, height: size + unit }" />
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import QRCode from "./qrcode.js"
|
|
10
|
+
let qrcode
|
|
11
|
+
export default {
|
|
12
|
+
name: "u-qrcode",
|
|
13
|
+
props: {
|
|
14
|
+
cid: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'u-qrcode-canvas' + Math.random().toString()
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 200
|
|
21
|
+
},
|
|
22
|
+
unit: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'px'
|
|
25
|
+
},
|
|
26
|
+
show: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
val: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
background: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '#ffffff'
|
|
37
|
+
},
|
|
38
|
+
foreground: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '#000000'
|
|
41
|
+
},
|
|
42
|
+
pdground: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '#000000'
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ''
|
|
49
|
+
},
|
|
50
|
+
iconSize: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 40
|
|
53
|
+
},
|
|
54
|
+
lv: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 3
|
|
57
|
+
},
|
|
58
|
+
onval: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
loadMake: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
usingComponents: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
showLoading: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
loadingText: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: '二维码生成中'
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
result: '',
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
_makeCode() {
|
|
86
|
+
let that = this
|
|
87
|
+
if (!this._empty(this.val)) {
|
|
88
|
+
qrcode = new QRCode({
|
|
89
|
+
context: that, // 上下文环境
|
|
90
|
+
canvasId: that.cid, // canvas-id
|
|
91
|
+
usingComponents: that.usingComponents, // 是否是自定义组件
|
|
92
|
+
showLoading: that.showLoading, // 是否显示loading
|
|
93
|
+
loadingText: that.loadingText, // loading文字
|
|
94
|
+
text: that.val, // 生成内容
|
|
95
|
+
size: that.size, // 二维码大小
|
|
96
|
+
background: that.background, // 背景色
|
|
97
|
+
foreground: that.foreground, // 前景色
|
|
98
|
+
pdground: that.pdground, // 定位角点颜色
|
|
99
|
+
correctLevel: that.lv, // 容错级别
|
|
100
|
+
image: that.icon, // 二维码图标
|
|
101
|
+
imageSize: that.iconSize,// 二维码图标大小
|
|
102
|
+
cbResult: function (res) { // 生成二维码的回调
|
|
103
|
+
that._result(res)
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
uni.showToast({
|
|
108
|
+
title: '二维码内容不能为空',
|
|
109
|
+
icon: 'none',
|
|
110
|
+
duration: 2000
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
_clearCode() {
|
|
115
|
+
this._result('')
|
|
116
|
+
qrcode.clear()
|
|
117
|
+
},
|
|
118
|
+
_saveCode() {
|
|
119
|
+
let that = this;
|
|
120
|
+
if (this.result != "") {
|
|
121
|
+
uni.saveImageToPhotosAlbum({
|
|
122
|
+
filePath: that.result,
|
|
123
|
+
success: function () {
|
|
124
|
+
uni.showToast({
|
|
125
|
+
title: '二维码保存成功',
|
|
126
|
+
icon: 'success',
|
|
127
|
+
duration: 2000
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
_result(res) {
|
|
134
|
+
this.result = res;
|
|
135
|
+
this.$emit('result', res)
|
|
136
|
+
},
|
|
137
|
+
_empty(v) {
|
|
138
|
+
let tp = typeof v,
|
|
139
|
+
rt = false;
|
|
140
|
+
if (tp == "number" && String(v) == "") {
|
|
141
|
+
rt = true
|
|
142
|
+
} else if (tp == "undefined") {
|
|
143
|
+
rt = true
|
|
144
|
+
} else if (tp == "object") {
|
|
145
|
+
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
|
|
146
|
+
} else if (tp == "string") {
|
|
147
|
+
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
|
|
148
|
+
} else if (tp == "function") {
|
|
149
|
+
rt = false
|
|
150
|
+
}
|
|
151
|
+
return rt
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
watch: {
|
|
155
|
+
size: function (n, o) {
|
|
156
|
+
if (n != o && !this._empty(n)) {
|
|
157
|
+
this.cSize = n
|
|
158
|
+
if (!this._empty(this.val)) {
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
this._makeCode()
|
|
161
|
+
}, 100);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
val: function (n, o) {
|
|
166
|
+
if (this.onval) {
|
|
167
|
+
if (n != o && !this._empty(n)) {
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
this._makeCode()
|
|
170
|
+
}, 0);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
computed: {
|
|
176
|
+
},
|
|
177
|
+
mounted: function () {
|
|
178
|
+
if (this.loadMake) {
|
|
179
|
+
if (!this._empty(this.val)) {
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
this._makeCode()
|
|
182
|
+
}, 0);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
<style lang="scss" scoped>
|
|
189
|
+
.u-qrcode {
|
|
190
|
+
position: relative;
|
|
191
|
+
|
|
192
|
+
&__canvas {
|
|
193
|
+
position: fixed;
|
|
194
|
+
top: -99999rpx;
|
|
195
|
+
left: -99999rpx;
|
|
196
|
+
z-index: -99999;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:style="[$u.addStyle(customStyle), wrapperStyle]"
|
|
7
7
|
>
|
|
8
8
|
<view
|
|
9
|
-
class="u-subsection__bar"
|
|
9
|
+
class="u-subsection__bar cursor-pointer"
|
|
10
10
|
ref="u-subsection__bar"
|
|
11
11
|
:style="[barStyle]"
|
|
12
12
|
:class="[
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
]"
|
|
25
25
|
></view>
|
|
26
26
|
<view
|
|
27
|
-
class="u-subsection__item"
|
|
27
|
+
class="u-subsection__item cursor-pointer"
|
|
28
28
|
:class="[
|
|
29
29
|
`u-subsection__item--${index}`,
|
|
30
30
|
index < list.length - 1 &&
|
|
@@ -96,10 +96,6 @@
|
|
|
96
96
|
// #ifdef APP-NVUE
|
|
97
97
|
const dom = uni.requireNativePlugin('dom')
|
|
98
98
|
// #endif
|
|
99
|
-
// #ifdef H5
|
|
100
|
-
// import ClipboardJS from "./clipboard.min.js"
|
|
101
|
-
import ClipboardJS from "clipboard"
|
|
102
|
-
// #endif
|
|
103
99
|
/**
|
|
104
100
|
* Tooltip
|
|
105
101
|
* @description
|
|
@@ -260,7 +256,6 @@
|
|
|
260
256
|
// 关闭组件
|
|
261
257
|
this.showTooltip = false
|
|
262
258
|
this.$emit('click', 0)
|
|
263
|
-
// #ifndef H5
|
|
264
259
|
uni.setClipboardData({
|
|
265
260
|
// 优先使用copyText字段,如果没有,则默认使用text字段当做复制的内容
|
|
266
261
|
data: this.copyText || this.text,
|
|
@@ -274,29 +269,6 @@
|
|
|
274
269
|
this.showTooltip = false
|
|
275
270
|
}
|
|
276
271
|
})
|
|
277
|
-
// #endif
|
|
278
|
-
|
|
279
|
-
// #ifdef H5
|
|
280
|
-
let event = window.event || e || {}
|
|
281
|
-
let clipboard = new ClipboardJS('', {
|
|
282
|
-
text: () => this.copyText || this.text
|
|
283
|
-
})
|
|
284
|
-
clipboard.on('success', (e) => {
|
|
285
|
-
this.showToast && uni.$u.toast('复制成功')
|
|
286
|
-
clipboard.off('success')
|
|
287
|
-
clipboard.off('error')
|
|
288
|
-
// 在单页应用中,需要销毁DOM的监听
|
|
289
|
-
clipboard.destroy()
|
|
290
|
-
})
|
|
291
|
-
clipboard.on('error', (e) => {
|
|
292
|
-
this.showToast && uni.$u.toast('复制失败')
|
|
293
|
-
clipboard.off('success')
|
|
294
|
-
clipboard.off('error')
|
|
295
|
-
// 在单页应用中,需要销毁DOM的监听
|
|
296
|
-
clipboard.destroy()
|
|
297
|
-
})
|
|
298
|
-
clipboard.onClick(event)
|
|
299
|
-
// #endif
|
|
300
272
|
}
|
|
301
273
|
}
|
|
302
274
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-plus",
|
|
3
3
|
"name": "uview-plus",
|
|
4
4
|
"displayName": "uview-plus3.0重磅发布,全面的Vue3移动组件库。",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.51",
|
|
6
6
|
"description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"uview",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"platforms": {
|
|
44
44
|
"cloud": {
|
|
45
45
|
"tcb": "y",
|
|
46
|
-
|
|
46
|
+
"aliyun": "y",
|
|
47
|
+
"alipay": "n"
|
|
47
48
|
},
|
|
48
49
|
"client": {
|
|
49
50
|
"Vue": {
|