1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
| <!DOCTYPE html>
| <html lang="zh">
| <head>
| <meta charset="UTF-8">
| <meta http-equiv="X-UA-Compatible" content="IE=edge">
| <meta name="viewport" content="width=device-width, initial-scale=1.0">
| <title>lime-qrcode</title>
| <style>
| html,body,canvas {
| margin: 0;
| padding: 0;
| width: 100%;
| height: 100%;
| pointer-events: none;
| /* background-color: rgba(255,0,0,0.1) */
| }
| </style>
| </head>
| <body>
| <canvas id="lime-qrcode"></canvas>
| <script type="text/javascript" src="./uni.webview.1.5.3.js"></script>
| <script type="text/javascript" src="./qrcode.min.js"></script>
| <script>
| var canvas = document.querySelector('#lime-qrcode')
| var pixelRatio = window.devicePixelRatio || 1
| function appendWatermark(image) {
| emit('append', mark.toDataURL())
| }
|
| var qrcode = new lime.QRCodeCanvas(canvas, {
| pixelRatio,
| })
| function render(props) {
| if(props.pixelRatio) {
| pixelRatio = props.pixelRatio
| }
| if(qrcode) {
| qrcode.render(props)
| }
| }
| function toDataURL(file) {
| if(qrcode && canvas) {
| try{
| const image = canvas.toDataURL()
| emit('toDataURL', {
| file,
| image
| })
| }catch(e){
| emit('toDataURL', {
| file,
| msg: e
| })
| }
|
| }
| }
| function emit(event, data) {
| postMessage({
| event,
| data
| });
| };
| function postMessage(data) {
| uni.postMessage({
| data
| });
| };
| // render({
| // content: ['Lime UI'],
| // // rotate: -22,
| // // baseSize: 2,
| // // fontGap: 3
| // })
| </script>
| </body>
| </html>
|
|