uview-plus 3.4.41 → 3.4.43
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
|
@@ -1104,6 +1104,11 @@ let QRCode = {};
|
|
|
1104
1104
|
}
|
|
1105
1105
|
// 创建canvas
|
|
1106
1106
|
let createCanvas = async function (options) {
|
|
1107
|
+
let isApp = false;
|
|
1108
|
+
// #ifdef APP
|
|
1109
|
+
isApp = true;
|
|
1110
|
+
// #endif
|
|
1111
|
+
|
|
1107
1112
|
if(options.showLoading){
|
|
1108
1113
|
uni.showLoading({
|
|
1109
1114
|
title: options.loadingText,
|
|
@@ -1122,7 +1127,13 @@ let QRCode = {};
|
|
|
1122
1127
|
canvas.width = options.size;
|
|
1123
1128
|
canvas.height = options.size;
|
|
1124
1129
|
// #endif
|
|
1130
|
+
// #ifdef APP
|
|
1131
|
+
ctx = uni.createCanvasContext(options.canvasId, options.context);
|
|
1132
|
+
// #endif
|
|
1133
|
+
// #ifndef APP
|
|
1125
1134
|
ctx = canvas.getContext('2d');
|
|
1135
|
+
// #endif
|
|
1136
|
+
|
|
1126
1137
|
}
|
|
1127
1138
|
// 设置组件中data里面的ctx
|
|
1128
1139
|
options.context.ctx = ctx;
|
|
@@ -1161,12 +1172,14 @@ let QRCode = {};
|
|
|
1161
1172
|
ctx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize);
|
|
1162
1173
|
}
|
|
1163
1174
|
else {
|
|
1164
|
-
// #ifdef H5
|
|
1175
|
+
// #ifdef H5 || APP
|
|
1165
1176
|
const img = new Image();
|
|
1166
1177
|
// #endif
|
|
1167
|
-
|
|
1178
|
+
|
|
1179
|
+
// #ifndef H5 || APP
|
|
1168
1180
|
const img = canvas.createImage();
|
|
1169
1181
|
// #endif
|
|
1182
|
+
|
|
1170
1183
|
img.onload = () => {
|
|
1171
1184
|
ctx.drawImage(img, x, y, ratioImgSize, ratioImgSize);
|
|
1172
1185
|
};
|
|
@@ -1174,7 +1187,7 @@ let QRCode = {};
|
|
|
1174
1187
|
}
|
|
1175
1188
|
// 画圆角矩形
|
|
1176
1189
|
function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
|
|
1177
|
-
if (options.nvueContext) {
|
|
1190
|
+
if (options.nvueContext || isApp) {
|
|
1178
1191
|
ctxi.setLineWidth(lineWidth);
|
|
1179
1192
|
ctxi.setFillStyle(options.background);
|
|
1180
1193
|
ctxi.setStrokeStyle(options.background);
|
|
@@ -1209,7 +1222,7 @@ let QRCode = {};
|
|
|
1209
1222
|
}
|
|
1210
1223
|
setTimeout(() => {
|
|
1211
1224
|
// canvas2 绘制是自动的不需要手动绘制
|
|
1212
|
-
if(options.nvueContext){
|
|
1225
|
+
if(options.nvueContext || isApp){
|
|
1213
1226
|
ctx.draw(true, () => {
|
|
1214
1227
|
// 保存到临时区域
|
|
1215
1228
|
setTimeout(() => {
|
|
@@ -1,32 +1,50 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<view class="u-qrcode"
|
|
3
3
|
:id="rootId"
|
|
4
4
|
:style="{
|
|
5
5
|
width: useRootHeightAndWidth ? '100%' : 'auto',
|
|
6
6
|
height: useRootHeightAndWidth ? '100%' : 'auto',
|
|
7
7
|
}"
|
|
8
8
|
@longpress="longpress">
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
<view class="u-qrcode__content" @click="preview">
|
|
10
|
+
|
|
11
|
+
<!-- #ifndef APP-NVUE || APP-PLUS -->
|
|
12
|
+
<canvas
|
|
12
13
|
class="u-qrcode__canvas"
|
|
13
|
-
|
|
14
|
+
:id="cid"
|
|
14
15
|
:canvas-id="cid"
|
|
15
16
|
type="2d"
|
|
16
17
|
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</view>
|
|
27
|
-
</view>
|
|
18
|
+
<!-- #endif -->
|
|
19
|
+
|
|
20
|
+
<!-- #ifdef APP-PLUS -->
|
|
21
|
+
<canvas
|
|
22
|
+
class="u-qrcode__canvas"
|
|
23
|
+
:id="cid"
|
|
24
|
+
:canvas-id="cid"
|
|
25
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
26
|
+
<!-- #endif -->
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
<!-- #ifdef APP-PLUS -->
|
|
29
|
+
<canvas
|
|
30
|
+
class="u-qrcode__canvas"
|
|
31
|
+
:id="cid"
|
|
32
|
+
:canvas-id="cid"
|
|
33
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
34
|
+
<!-- #endif -->
|
|
35
|
+
|
|
36
|
+
<!-- #ifdef APP-NVUE -->
|
|
37
|
+
<gcanvas class="u-qrcode__canvas" ref="gcanvess"
|
|
38
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }">
|
|
39
|
+
</gcanvas>
|
|
40
|
+
<!-- #endif -->
|
|
41
|
+
<view v-if="showLoading && loading" class="u-qrcode__loading"
|
|
42
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }">
|
|
43
|
+
<up-loading-icon vertical :text="loadingText" textSize="14px"></up-loading-icon>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
|
|
47
|
+
</view>
|
|
30
48
|
</template>
|
|
31
49
|
|
|
32
50
|
<script>
|
|
@@ -34,215 +52,215 @@ import QRCode from "./qrcode.js"
|
|
|
34
52
|
// #ifdef APP-NVUE
|
|
35
53
|
// https://github.com/dcloudio/NvueCanvasDemo/blob/master/README.md
|
|
36
54
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
enable,
|
|
56
|
+
WeexBridge
|
|
39
57
|
} from '../../libs/util/gcanvas/index.js';
|
|
40
58
|
// #endif
|
|
41
59
|
let qrcode
|
|
42
60
|
export default {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
61
|
+
name: "u-qrcode",
|
|
62
|
+
props: {
|
|
63
|
+
cid: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: () => `u-qrcode-canvas${Math.floor(Math.random() * 1000000)}`
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 200
|
|
70
|
+
},
|
|
71
|
+
unit: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: 'px'
|
|
74
|
+
},
|
|
75
|
+
show: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
val: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ''
|
|
82
|
+
},
|
|
83
|
+
background: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: '#ffffff'
|
|
86
|
+
},
|
|
87
|
+
foreground: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '#000000'
|
|
90
|
+
},
|
|
91
|
+
pdground: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: '#000000'
|
|
94
|
+
},
|
|
95
|
+
icon: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: ''
|
|
98
|
+
},
|
|
99
|
+
iconSize: {
|
|
100
|
+
type: Number,
|
|
101
|
+
default: 40
|
|
102
|
+
},
|
|
103
|
+
lv: {
|
|
104
|
+
type: Number,
|
|
105
|
+
default: 3
|
|
106
|
+
},
|
|
107
|
+
onval: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
default: true
|
|
110
|
+
},
|
|
111
|
+
loadMake: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true
|
|
114
|
+
},
|
|
115
|
+
usingComponents: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true
|
|
118
|
+
},
|
|
119
|
+
showLoading: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: true
|
|
122
|
+
},
|
|
123
|
+
loadingText: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: '生成中'
|
|
126
|
+
},
|
|
127
|
+
allowPreview: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
113
131
|
// 是否使用根节点宽高
|
|
114
132
|
useRootHeightAndWidth: {
|
|
115
133
|
type: Boolean,
|
|
116
134
|
default: () => false
|
|
117
135
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
},
|
|
137
|
+
emits: ['result', 'longpressCallback'],
|
|
138
|
+
data() {
|
|
139
|
+
return {
|
|
140
|
+
loading: false,
|
|
141
|
+
result: '',
|
|
142
|
+
popupShow: false,
|
|
143
|
+
list: [
|
|
144
|
+
{
|
|
145
|
+
name: '保存二维码',
|
|
146
|
+
}
|
|
147
|
+
],
|
|
130
148
|
rootId: `rootId${Number(Math.random() * 100).toFixed(0)}`,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
ganvas: null,
|
|
150
|
+
context: '',
|
|
151
|
+
canvasObj: {},
|
|
134
152
|
sizeLocal: this.size,
|
|
135
153
|
ctx: null, // ctx 在new Qrcode 时js文件内部设置
|
|
136
154
|
canvas: null, // ctx 在new Qrcode 时js文件内部设置
|
|
137
|
-
|
|
138
|
-
|
|
155
|
+
}
|
|
156
|
+
},
|
|
139
157
|
async mounted(){
|
|
140
158
|
// 如果使用根节点的宽高 则 重新设置 size
|
|
141
159
|
if(this.useRootHeightAndWidth){
|
|
142
160
|
await this.setNewSize()
|
|
143
161
|
}
|
|
144
162
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
163
|
+
// #ifdef APP-NVUE
|
|
164
|
+
/*获取元素引用*/
|
|
165
|
+
this.ganvas = this.$refs["gcanvess"]
|
|
166
|
+
/*通过元素引用获取canvas对象*/
|
|
167
|
+
this.canvasObj = enable(this.ganvas, {
|
|
168
|
+
bridge: WeexBridge
|
|
169
|
+
})
|
|
170
|
+
/*获取绘图所需的上下文,目前不支持3d*/
|
|
171
|
+
this.context = this.canvasObj.getContext('2d')
|
|
172
|
+
// #endif
|
|
155
173
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
174
|
+
if (this.loadMake) {
|
|
175
|
+
if (!this._empty(this.val)) {
|
|
176
|
+
setTimeout(() => {
|
|
159
177
|
setTimeout(()=>{
|
|
160
178
|
this._makeCode()
|
|
161
179
|
})
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
180
|
+
}, 0);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
methods: {
|
|
185
|
+
_makeCode() {
|
|
186
|
+
let that = this
|
|
187
|
+
if (!this._empty(this.val)) {
|
|
188
|
+
// #ifndef APP-NVUE
|
|
189
|
+
this.loading = true
|
|
190
|
+
// #endif
|
|
191
|
+
qrcode = new QRCode({
|
|
192
|
+
context: that, // 上下文环境
|
|
193
|
+
canvasId: that.cid, // canvas-id
|
|
194
|
+
nvueContext: that.context,
|
|
195
|
+
usingComponents: that.usingComponents, // 是否是自定义组件
|
|
196
|
+
showLoading: false, // 是否显示loading
|
|
197
|
+
loadingText: that.loadingText, // loading文字
|
|
198
|
+
text: that.val, // 生成内容
|
|
199
|
+
size: that.sizeLocal, // 二维码大小
|
|
200
|
+
background: that.background, // 背景色
|
|
201
|
+
foreground: that.foreground, // 前景色
|
|
202
|
+
pdground: that.pdground, // 定位角点颜色
|
|
203
|
+
correctLevel: that.lv, // 容错级别
|
|
204
|
+
image: that.icon, // 二维码图标
|
|
205
|
+
imageSize: that.iconSize,// 二维码图标大小
|
|
206
|
+
cbResult: function (res) { // 生成二维码的回调
|
|
207
|
+
that._result(res)
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
uni.showToast({
|
|
212
|
+
title: '二维码内容不能为空',
|
|
213
|
+
icon: 'none',
|
|
214
|
+
duration: 2000
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
_clearCode() {
|
|
219
|
+
this._result('')
|
|
220
|
+
qrcode.clear()
|
|
221
|
+
},
|
|
222
|
+
_saveCode() {
|
|
223
|
+
let that = this;
|
|
224
|
+
if (this.result != "") {
|
|
225
|
+
uni.saveImageToPhotosAlbum({
|
|
226
|
+
filePath: that.result,
|
|
227
|
+
success: function () {
|
|
228
|
+
uni.showToast({
|
|
229
|
+
title: '二维码保存成功',
|
|
230
|
+
icon: 'success',
|
|
231
|
+
duration: 2000
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
preview(e) {
|
|
238
|
+
// 预览图片
|
|
239
|
+
// console.log(this.result)
|
|
240
|
+
if (this.allowPreview) {
|
|
241
|
+
uni.previewImage({
|
|
242
|
+
urls: [this.result],
|
|
243
|
+
longPressActions: {
|
|
244
|
+
itemList: ['保存二维码图片'],
|
|
245
|
+
success: function(data) {
|
|
246
|
+
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
|
247
|
+
switch (data.tapIndex) {
|
|
248
|
+
case 0:
|
|
249
|
+
that._saveCode();
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
fail: function(err) {
|
|
254
|
+
console.log(err.errMsg);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
this.$emit('preview', {
|
|
260
|
+
url: this.result
|
|
261
|
+
}, e)
|
|
262
|
+
},
|
|
263
|
+
async longpress() {
|
|
246
264
|
if (this.context) {
|
|
247
265
|
this.ctx.toTempFilePath(
|
|
248
266
|
0,
|
|
@@ -259,17 +277,30 @@ export default {
|
|
|
259
277
|
);
|
|
260
278
|
}
|
|
261
279
|
else {
|
|
262
|
-
|
|
280
|
+
|
|
263
281
|
// #ifdef MP-TOUTIAO || H5
|
|
264
282
|
this.$emit('longpressCallback', this.ctx.canvas.toDataURL("image/png", 1));
|
|
265
283
|
// #endif
|
|
266
284
|
|
|
267
|
-
// #
|
|
285
|
+
// #ifdef APP-PLUS
|
|
286
|
+
uni.canvasToTempFilePath(
|
|
287
|
+
{
|
|
288
|
+
canvasId: this.cid,
|
|
289
|
+
success :res => {
|
|
290
|
+
this.$emit('longpressCallback', res.tempFilePath)
|
|
291
|
+
},
|
|
292
|
+
fail: err =>{
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
this)
|
|
296
|
+
// #endif
|
|
297
|
+
|
|
298
|
+
// #ifndef MP-TOUTIAO || H5 || APP-PLUS
|
|
299
|
+
const canvas = await this.getNode(this.cId,true);
|
|
268
300
|
uni.canvasToTempFilePath(
|
|
269
301
|
{
|
|
270
302
|
canvas,
|
|
271
303
|
success :res => {
|
|
272
|
-
console.log(res.tempFilePath)
|
|
273
304
|
this.$emit('longpressCallback', res.tempFilePath)
|
|
274
305
|
},
|
|
275
306
|
fail: err =>{
|
|
@@ -280,7 +311,7 @@ export default {
|
|
|
280
311
|
|
|
281
312
|
}
|
|
282
313
|
|
|
283
|
-
|
|
314
|
+
},
|
|
284
315
|
|
|
285
316
|
/**
|
|
286
317
|
* 使用根节点宽高 设置新的size
|
|
@@ -326,74 +357,74 @@ export default {
|
|
|
326
357
|
})
|
|
327
358
|
},
|
|
328
359
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
360
|
+
selectClick(index) {
|
|
361
|
+
switch (index) {
|
|
362
|
+
case 0:
|
|
363
|
+
alert('保存二维码')
|
|
364
|
+
this._saveCode();
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
_result(res) {
|
|
369
|
+
this.loading = false;
|
|
370
|
+
this.result = res;
|
|
371
|
+
this.$emit('result', res);
|
|
372
|
+
},
|
|
373
|
+
_empty(v) {
|
|
374
|
+
let tp = typeof v,
|
|
375
|
+
rt = false;
|
|
376
|
+
if (tp == "number" && String(v) == "") {
|
|
377
|
+
rt = true
|
|
378
|
+
} else if (tp == "undefined") {
|
|
379
|
+
rt = true
|
|
380
|
+
} else if (tp == "object") {
|
|
381
|
+
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
|
|
382
|
+
} else if (tp == "string") {
|
|
383
|
+
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
|
|
384
|
+
} else if (tp == "function") {
|
|
385
|
+
rt = false
|
|
386
|
+
}
|
|
387
|
+
return rt
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
watch: {
|
|
391
|
+
size: function (n, o) {
|
|
392
|
+
if (n != o && !this._empty(n)) {
|
|
393
|
+
this.cSize = n
|
|
394
|
+
if (!this._empty(this.val)) {
|
|
395
|
+
setTimeout(() => {
|
|
396
|
+
this._makeCode()
|
|
397
|
+
}, 100);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
val: function (n, o) {
|
|
402
|
+
if (this.onval) {
|
|
403
|
+
if (n != o && !this._empty(n)) {
|
|
404
|
+
setTimeout(() => {
|
|
405
|
+
this._makeCode()
|
|
406
|
+
}, 0);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
computed: {
|
|
412
|
+
}
|
|
382
413
|
}
|
|
383
414
|
</script>
|
|
384
415
|
<style lang="scss" scoped>
|
|
385
416
|
.u-qrcode {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
417
|
+
&__loading {
|
|
418
|
+
display: flex;
|
|
419
|
+
justify-content: center;
|
|
420
|
+
align-items: center;
|
|
421
|
+
background-color: #f7f7f7;
|
|
422
|
+
position: absolute;
|
|
423
|
+
top: 0;
|
|
424
|
+
bottom: 0;
|
|
425
|
+
left: 0;
|
|
426
|
+
right: 0;
|
|
427
|
+
}
|
|
397
428
|
|
|
398
429
|
/* #ifdef MP-TOUTIAO */
|
|
399
430
|
/**字节小程序在编译时会出现一个 [hidde]:{ display: none !important; } 这个样式
|
|
@@ -404,15 +435,15 @@ export default {
|
|
|
404
435
|
}
|
|
405
436
|
/* #endif */
|
|
406
437
|
|
|
407
|
-
|
|
408
|
-
|
|
438
|
+
&__content {
|
|
439
|
+
position: relative;
|
|
409
440
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
441
|
+
&__canvas {
|
|
442
|
+
position: fixed;
|
|
443
|
+
top: -99999rpx;
|
|
444
|
+
left: -99999rpx;
|
|
445
|
+
z-index: -99999;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
417
448
|
}
|
|
418
449
|
</style>
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
headerCellClassName ? headerCellClassName(col) : '',
|
|
11
11
|
col.fixed === 'left' ? 'u-table-fixed-left' : '',
|
|
12
12
|
col.fixed === 'right' ? 'u-table-fixed-right' : ''
|
|
13
|
-
]" @click="handleHeaderClick(col)">
|
|
14
|
-
|
|
13
|
+
]" @click="handleHeaderClick(col)">
|
|
14
|
+
<slot name="header" :column="col" :columnIndex="colIndex" :level="1">
|
|
15
|
+
{{ col.title }}
|
|
16
|
+
</slot>
|
|
15
17
|
<view v-if="col.sortable">
|
|
16
18
|
{{ getSortIcon(col.key) }}
|
|
17
19
|
</view>
|
package/package.json
CHANGED