ci-plus 1.2.5 → 1.2.7

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.
@@ -0,0 +1,4 @@
1
+ import _CiQrcode from './qrcode.vue'
2
+ import { withInstall } from '../utils/index';
3
+ export const CiQrcode = withInstall(_CiQrcode)
4
+ export default CiQrcode
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <canvas ref="qrcode"></canvas>
3
+ </template>
4
+ <script setup lang="ts">
5
+ defineOptions({ name: 'ci-qrcode' })
6
+ import { ref, onMounted, defineProps, PropType } from 'vue'
7
+ import QRCode from 'qrcode'
8
+ // 用于遮罩符号的遮罩图案。 可能的值为0、1、2、3、4、5、6、7。
9
+ type MaskPattern = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
10
+
11
+ const props = defineProps({
12
+ // 二维码内容
13
+ codeValue: {
14
+ type: String,
15
+ default: ''
16
+ },
17
+ // 二维码宽高
18
+ width: {
19
+ type: Number,
20
+ default: 100
21
+ },
22
+ // 二维码边框白色区域宽度。
23
+ margin: {
24
+ type: Number,
25
+ default: 1
26
+ },
27
+ scale: {
28
+ type: Number,
29
+ default: 4
30
+ },
31
+ // 二维码颜色
32
+ color: {
33
+ type: Object,
34
+ default: () => {
35
+ return {
36
+ dark: '#000000', // 黑色
37
+ light: '#ffffff' // 白色
38
+ }
39
+ }
40
+ },
41
+ // 用于遮罩符号的遮罩图案。 可能的值为0、1、2、3、4、5、6、7。
42
+ maskPattern: {
43
+ type: Number as PropType<MaskPattern>,
44
+ default: 1
45
+ }
46
+ })
47
+ const qrcode = ref(null)
48
+ onMounted(() => {
49
+ render()
50
+ })
51
+ const render = () => {
52
+ QRCode.toCanvas(
53
+ qrcode.value,
54
+ props.codeValue,
55
+ {
56
+ version: 1.0,
57
+ errorCorrectionLevel: 'M',
58
+ maskPattern: props.maskPattern, //用于遮罩符号的遮罩图案。 可能的值为0、1、2、3、4、5、6、7。
59
+ margin: props.margin, //定义二维码边框白色区域宽度。
60
+ scale: props.scale, //比例因子。值1表示每个模块1px(黑点)。
61
+ small: false, //输出较小的二维码。仅与终端渲染器相关。
62
+ width: props.width, //宽高
63
+ color: props.color // 二维码颜色
64
+ },
65
+ (error) => {
66
+ if (error) {
67
+ console.log(error)
68
+ }
69
+ }
70
+ )
71
+ }
72
+ </script>
package/src/index.ts CHANGED
@@ -11,7 +11,8 @@ export * from './sortableTable/index/sortableTable'; // 导出排序表格
11
11
  export * from './sortableTable/index/sortableTableDialog'; // 导出表排序组件
12
12
  export * from './sortableTable/index/sortableTableColumnCell'; // 导出表列组件
13
13
 
14
- export * from './identificationCard'; // 导出标识卡模板组件
14
+ export * from './identificationCard'; // 导出标识卡条形码模板组件
15
+ export * from './identificationCard/qrcode'; // 导出标识卡二维码模板组件
15
16
 
16
17
  export * from './fileRelated/index/ciseeFile'; // 导出附件查看组件
17
18
  export * from './fileRelated/index/ciupload'; // 导出附件上传组件