@robot-admin/naive-ui-components 0.4.3 → 0.4.5
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/dist/C_ActionBar.cjs +1 -5
- package/dist/C_ActionBar.js +1 -4
- package/dist/C_ActionBar.js.map +1 -0
- package/dist/C_ActionBar2.js +1 -195
- package/dist/C_ActionBar2.js.map +1 -1
- package/dist/{C_AntV-DGjscTWa.css.map → C_AntV-A3NXx_sF.css.map} +1 -1
- package/dist/C_AntV.cjs +1 -8
- package/dist/C_AntV.js +1 -4
- package/dist/C_AntV.js.map +1 -0
- package/dist/C_AntV2.js +4 -3149
- package/dist/C_AntV2.js.map +1 -1
- package/dist/C_Barcode.cjs +1 -4
- package/dist/C_Barcode.js +1 -3
- package/dist/C_Barcode.js.map +1 -0
- package/dist/C_Barcode2.js +1 -67
- package/dist/C_Barcode2.js.map +1 -1
- package/dist/C_Captcha.cjs +1 -4
- package/dist/C_Captcha.js +1 -3
- package/dist/C_Captcha.js.map +1 -0
- package/dist/C_Captcha2.js +1 -154
- package/dist/C_Captcha2.js.map +1 -1
- package/dist/C_Cascade.cjs +1 -4
- package/dist/C_Cascade.js +1 -3
- package/dist/C_Cascade.js.map +1 -0
- package/dist/C_Cascade2.js +1 -102
- package/dist/C_Cascade2.js.map +1 -1
- package/dist/C_City.cjs +1 -4
- package/dist/C_City.js +1 -3
- package/dist/C_City.js.map +1 -0
- package/dist/C_City2.js +1 -840
- package/dist/C_City2.js.map +1 -1
- package/dist/C_Code.cjs +1 -5
- package/dist/C_Code.js +1 -4
- package/dist/C_Code.js.map +1 -0
- package/dist/C_Code2.js +1 -346
- package/dist/C_Code2.js.map +1 -1
- package/dist/C_CollapsePanel.cjs +1 -6
- package/dist/C_CollapsePanel.js +1 -4
- package/dist/C_CollapsePanel.js.map +1 -0
- package/dist/C_CollapsePanel2.js +1 -318
- package/dist/C_CollapsePanel2.js.map +1 -1
- package/dist/C_Cron.cjs +1 -15
- package/dist/C_Cron.js +1 -4
- package/dist/C_Cron.js.map +1 -0
- package/dist/C_Cron2.js +1 -1209
- package/dist/C_Cron2.js.map +1 -1
- package/dist/C_Date.cjs +1 -4
- package/dist/C_Date.js +1 -3
- package/dist/C_Date.js.map +1 -0
- package/dist/C_Date2.js +1 -218
- package/dist/C_Date2.js.map +1 -1
- package/dist/C_Draggable.cjs +1 -5
- package/dist/C_Draggable.js +1 -3
- package/dist/C_Draggable.js.map +1 -0
- package/dist/C_Draggable2.js +1 -294
- package/dist/C_Draggable2.js.map +1 -1
- package/dist/C_Editor.cjs +1 -4
- package/dist/C_Editor.js +1 -3
- package/dist/C_Editor.js.map +1 -0
- package/dist/C_Editor2.js +1 -159
- package/dist/C_Editor2.js.map +1 -1
- package/dist/{C_FilePreview-B4XgTv-h.css.map → C_FilePreview-DHGlV4OR.css.map} +1 -1
- package/dist/C_FilePreview.cjs +1 -7
- package/dist/C_FilePreview.js +1 -4
- package/dist/C_FilePreview.js.map +1 -0
- package/dist/C_FilePreview2.js +1 -1031
- package/dist/C_FilePreview2.js.map +1 -1
- package/dist/{C_Form-DLb9FtAb.css.map → C_Form-CKHvXL3O.css.map} +1 -1
- package/dist/C_Form.cjs +1 -16
- package/dist/C_Form.js +1 -5
- package/dist/C_Form.js.map +1 -0
- package/dist/C_Form2.js +1 -2569
- package/dist/C_Form2.js.map +1 -1
- package/dist/{C_FormSearch-DlIEoh7X.css.map → C_FormSearch-DBNtnjaL.css.map} +1 -1
- package/dist/C_FormSearch.cjs +1 -6
- package/dist/C_FormSearch.js +1 -3
- package/dist/C_FormSearch.js.map +1 -0
- package/dist/C_FormSearch2.js +1 -355
- package/dist/C_FormSearch2.js.map +1 -1
- package/dist/C_FormulaEditor.cjs +1 -13
- package/dist/C_FormulaEditor.js +1 -4
- package/dist/C_FormulaEditor.js.map +1 -0
- package/dist/C_FormulaEditor2.js +1 -1432
- package/dist/C_FormulaEditor2.js.map +1 -1
- package/dist/C_FullCalendar-DLUdCtqf.css.map +1 -0
- package/dist/C_FullCalendar.cjs +1 -9
- package/dist/C_FullCalendar.js +1 -3
- package/dist/C_FullCalendar.js.map +1 -0
- package/dist/C_FullCalendar2.js +1 -376
- package/dist/C_FullCalendar2.js.map +1 -1
- package/dist/C_GlobalSearch.cjs +1 -5
- package/dist/C_GlobalSearch.js +1 -3
- package/dist/C_GlobalSearch.js.map +1 -0
- package/dist/C_GlobalSearch2.js +1 -335
- package/dist/C_GlobalSearch2.js.map +1 -1
- package/dist/C_Guide.cjs +1 -5
- package/dist/C_Guide.js +1 -4
- package/dist/C_Guide.js.map +1 -0
- package/dist/C_Guide2.js +1 -60
- package/dist/C_Guide2.js.map +1 -1
- package/dist/C_Icon.cjs +1 -4
- package/dist/C_Icon.js +1 -3
- package/dist/C_Icon.js.map +1 -0
- package/dist/C_Icon2.js +1 -285
- package/dist/C_Icon2.js.map +1 -1
- package/dist/C_ImageCropper.cjs +1 -6
- package/dist/C_ImageCropper.js +1 -4
- package/dist/C_ImageCropper.js.map +1 -0
- package/dist/C_ImageCropper2.js +1 -722
- package/dist/C_ImageCropper2.js.map +1 -1
- package/dist/C_Language.cjs +1 -5
- package/dist/C_Language.js +1 -4
- package/dist/C_Language.js.map +1 -0
- package/dist/C_Language2.js +1 -78
- package/dist/C_Language2.js.map +1 -1
- package/dist/C_Map.cjs +1 -7
- package/dist/C_Map.js +1 -3
- package/dist/C_Map.js.map +1 -0
- package/dist/C_Map2.js +1 -198
- package/dist/C_Map2.js.map +1 -1
- package/dist/{C_Markdown-C2uiBVSW.css.map → C_Markdown-BbTvdFCl.css.map} +1 -1
- package/dist/C_Markdown.cjs +1 -4
- package/dist/C_Markdown.js +1 -3
- package/dist/C_Markdown.js.map +1 -0
- package/dist/C_Markdown2.js +1 -185
- package/dist/C_Markdown2.js.map +1 -1
- package/dist/C_NotificationCenter.cjs +1 -20
- package/dist/C_NotificationCenter.js +1 -4
- package/dist/C_NotificationCenter.js.map +1 -0
- package/dist/C_NotificationCenter2.js +1 -1383
- package/dist/C_NotificationCenter2.js.map +1 -1
- package/dist/C_Progress.cjs +1 -4
- package/dist/C_Progress.js +1 -3
- package/dist/C_Progress.js.map +1 -0
- package/dist/C_Progress2.js +1 -102
- package/dist/C_Progress2.js.map +1 -1
- package/dist/C_QRCode.cjs +1 -5
- package/dist/C_QRCode.js +1 -3
- package/dist/C_QRCode.js.map +1 -0
- package/dist/C_QRCode2.js +1 -217
- package/dist/C_QRCode2.js.map +1 -1
- package/dist/C_Signature.cjs +1 -8
- package/dist/C_Signature.js +1 -4
- package/dist/C_Signature.js.map +1 -0
- package/dist/C_Signature2.js +1 -617
- package/dist/C_Signature2.js.map +1 -1
- package/dist/C_SplitPane.cjs +1 -6
- package/dist/C_SplitPane.js +1 -4
- package/dist/C_SplitPane.js.map +1 -0
- package/dist/C_SplitPane2.js +1 -355
- package/dist/C_SplitPane2.js.map +1 -1
- package/dist/C_Steps.cjs +1 -4
- package/dist/C_Steps.js +1 -3
- package/dist/C_Steps.js.map +1 -0
- package/dist/C_Steps2.js +1 -81
- package/dist/C_Steps2.js.map +1 -1
- package/dist/{C_Table-C55H4kPr.css.map → C_Table-tbUx-R4H.css.map} +1 -1
- package/dist/C_Table.cjs +1 -20
- package/dist/C_Table.js +1 -6
- package/dist/C_Table.js.map +1 -0
- package/dist/C_Table2.js +1 -3023
- package/dist/C_Table2.js.map +1 -1
- package/dist/C_Theme.cjs +1 -5
- package/dist/C_Theme.js +1 -4
- package/dist/C_Theme.js.map +1 -0
- package/dist/C_Theme2.js +1 -63
- package/dist/C_Theme2.js.map +1 -1
- package/dist/C_Time.cjs +1 -5
- package/dist/C_Time.js +1 -3
- package/dist/C_Time.js.map +1 -0
- package/dist/C_Time2.js +1 -198
- package/dist/C_Time2.js.map +1 -1
- package/dist/C_Tree.cjs +1 -7
- package/dist/C_Tree.js +1 -4
- package/dist/C_Tree.js.map +1 -0
- package/dist/C_Tree2.js +1 -440
- package/dist/C_Tree2.js.map +1 -1
- package/dist/C_Upload.cjs +1 -12
- package/dist/C_Upload.js +1 -4
- package/dist/C_Upload.js.map +1 -0
- package/dist/C_Upload2.js +2 -1365
- package/dist/C_Upload2.js.map +1 -1
- package/dist/C_VideoPlayer.cjs +1 -23
- package/dist/C_VideoPlayer.js +1 -3
- package/dist/C_VideoPlayer.js.map +1 -0
- package/dist/C_VideoPlayer2.js +3 -1932
- package/dist/C_VideoPlayer2.js.map +1 -1
- package/dist/C_VtableGantt.cjs +1 -6
- package/dist/C_VtableGantt.js +1 -4
- package/dist/C_VtableGantt.js.map +1 -0
- package/dist/C_VtableGantt2.js +1 -872
- package/dist/C_VtableGantt2.js.map +1 -1
- package/dist/C_WaterFall.cjs +1 -13
- package/dist/C_WaterFall.js +1 -3
- package/dist/C_WaterFall.js.map +1 -0
- package/dist/C_WaterFall2.js +1 -364
- package/dist/C_WaterFall2.js.map +1 -1
- package/dist/{C_WorkFlow-CSO86Cuc.css.map → C_WorkFlow-7F6op6qN.css.map} +1 -1
- package/dist/C_WorkFlow.cjs +1 -8
- package/dist/C_WorkFlow.js +1 -4
- package/dist/C_WorkFlow.js.map +1 -0
- package/dist/C_WorkFlow2.js +1 -1983
- package/dist/C_WorkFlow2.js.map +1 -1
- package/dist/chunk.js +1 -18
- package/dist/city.js +1 -4816
- package/dist/constants.d.ts +1 -1
- package/dist/constants2.d.ts +2 -2
- package/dist/constants4.d.ts +8 -8
- package/dist/constants5.d.ts +2 -2
- package/dist/data.d.ts +2 -2
- package/dist/export-helper.js +1 -9
- package/dist/index.cjs +2 -413
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -231
- package/dist/index.js.map +1 -1
- package/dist/index.vue.d.ts +2 -2
- package/dist/index10.vue.d.ts +6 -6
- package/dist/index12.vue.d.ts +4 -4
- package/dist/index13.vue.d.ts +1 -1
- package/dist/index14.vue.d.ts +1 -1
- package/dist/index15.vue.d.ts +1 -1
- package/dist/index16.vue.d.ts +2 -2
- package/dist/index2.vue.d.ts +2 -2
- package/dist/index3.vue.d.ts +4 -4
- package/dist/index5.vue.d.ts +1 -1
- package/dist/index7.vue.d.ts +4 -4
- package/dist/index8.vue.d.ts +3 -3
- package/dist/index9.vue.d.ts +1 -1
- package/dist/resolver.cjs +2 -89
- package/dist/resolver.cjs.map +1 -0
- package/dist/resolver.js +1 -86
- package/dist/resolver.js.map +1 -1
- package/dist/storage.js +1 -30
- package/dist/storage.js.map +1 -1
- package/dist/style.css +447 -447
- package/dist/useCalendarEvents.d.ts +1 -1
- package/dist/useCollapsePanel.d.ts +2 -2
- package/dist/useCropperCore.d.ts +3 -3
- package/dist/useDraggableLayout.d.ts +9 -9
- package/dist/useDynamicFormState.d.ts +5 -5
- package/dist/useEdgeInteraction.d.ts +4 -12
- package/dist/useInfiniteScroll.d.ts +2 -2
- package/dist/useModalEdit.d.ts +45 -21
- package/dist/useQRCode.d.ts +3 -3
- package/dist/useSearchState.d.ts +2 -2
- package/dist/useSignatureHistory.d.ts +2 -2
- package/dist/useSplitResize.d.ts +6 -6
- package/dist/useTimeSelection.d.ts +2 -2
- package/dist/useTreeOperations.d.ts +6 -6
- package/dist/useWorkflowValidation.d.ts +3 -3
- package/package.json +1 -2
- package/dist/C_FullCalendar-BULCIlVK.css.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants2.d.ts.map +0 -1
- package/dist/constants3.d.ts.map +0 -1
- package/dist/constants4.d.ts.map +0 -1
- package/dist/constants5.d.ts.map +0 -1
- package/dist/data.d.ts.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.vue.d.ts.map +0 -1
- package/dist/index10.vue.d.ts.map +0 -1
- package/dist/index11.vue.d.ts.map +0 -1
- package/dist/index12.vue.d.ts.map +0 -1
- package/dist/index13.vue.d.ts.map +0 -1
- package/dist/index14.vue.d.ts.map +0 -1
- package/dist/index15.vue.d.ts.map +0 -1
- package/dist/index16.vue.d.ts.map +0 -1
- package/dist/index2.vue.d.ts.map +0 -1
- package/dist/index3.vue.d.ts.map +0 -1
- package/dist/index4.vue.d.ts.map +0 -1
- package/dist/index5.vue.d.ts.map +0 -1
- package/dist/index6.vue.d.ts.map +0 -1
- package/dist/index7.vue.d.ts.map +0 -1
- package/dist/index8.vue.d.ts.map +0 -1
- package/dist/index9.vue.d.ts.map +0 -1
- package/dist/resolver.d.cts.map +0 -1
- package/dist/resolver.d.ts.map +0 -1
- package/dist/useCalendarEvents.d.ts.map +0 -1
- package/dist/useCollapsePanel.d.ts.map +0 -1
- package/dist/useCropperCore.d.ts.map +0 -1
- package/dist/useDraggableLayout.d.ts.map +0 -1
- package/dist/useDynamicFormState.d.ts.map +0 -1
- package/dist/useEdgeInteraction.d.ts.map +0 -1
- package/dist/useFullscreen.d.ts.map +0 -1
- package/dist/useGlobalSearch.d.ts.map +0 -1
- package/dist/useInfiniteScroll.d.ts.map +0 -1
- package/dist/useModalEdit.d.ts.map +0 -1
- package/dist/useQRCode.d.ts.map +0 -1
- package/dist/useSearchState.d.ts.map +0 -1
- package/dist/useSignatureHistory.d.ts.map +0 -1
- package/dist/useSplitResize.d.ts.map +0 -1
- package/dist/useTimeSelection.d.ts.map +0 -1
- package/dist/useTreeOperations.d.ts.map +0 -1
- package/dist/useWorkflowValidation.d.ts.map +0 -1
package/dist/C_Barcode.cjs
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_C_Barcode = require('./C_Barcode.js');
|
|
3
|
-
|
|
4
|
-
exports.C_Barcode = require_C_Barcode.C_Barcode_default;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./C_Barcode.js`);exports.C_Barcode=e.t;
|
package/dist/C_Barcode.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"C_Barcode.js","names":["showBorder","showLabel","label"],"sources":["../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":"kmBE+CA,IAAM,EAAQ,EAcR,EAAO,EAIP,GAAA,EAAA,EAAA,eAA+B,CACnC,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,aAAc,EAAM,SACpB,SAAU,EAAM,SAChB,aAAc,EAAM,aACpB,UAAW,EAAM,UACjB,WAAY,EAAM,WACnB,EAAE,CAEG,EAAe,GAAiB,CACpC,QAAQ,MAAM,WAAY,EAAM,CAChC,EAAK,QAAS,EAAM,2DAhEd,MAPN,EAOM,EAAA,EAAA,EAAA,oBAJE,MAAA,CAFD,OAAA,EAAA,EAAA,gBAAK,CAAC,kBAAiB,CAAA,cAA0BA,EAAAA,WAAU,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,EAAA,cAAA,EAAA,EAAA,OACL,EAAA,QAAA,EAAA,EAAA,EAAA,YAArC,EAAqC,MAAzB,CAAG,QAAO,EAAW,CAAA,CAAA,KAAA,GAAA,CAAA,CAAA,EAAA,CAE5CC,EAAAA,WAAaC,EAAAA,QAAAA,EAAAA,EAAAA,YAAAA,EAAAA,EAAAA,EAAAA,oBAElB,MAFN,GAAA,EAAA,EAAA,iBACKA,EAAAA,MAAK,CAAA,EAAA,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CAAA,CAAA"}
|
package/dist/C_Barcode2.js
CHANGED
|
@@ -1,68 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, toDisplayString, unref } from "vue";
|
|
3
|
-
import VueBarcode from "@chenfengyuan/vue-barcode";
|
|
4
|
-
|
|
5
|
-
//#region src/components/C_Barcode/index.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
const _hoisted_1 = { class: "c-barcode" };
|
|
7
|
-
const _hoisted_2 = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "barcode-label"
|
|
10
|
-
};
|
|
11
|
-
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
12
|
-
name: "C_Barcode",
|
|
13
|
-
__name: "index",
|
|
14
|
-
props: {
|
|
15
|
-
value: {},
|
|
16
|
-
format: { default: "CODE128" },
|
|
17
|
-
width: { default: 2 },
|
|
18
|
-
height: { default: 80 },
|
|
19
|
-
showText: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: true
|
|
22
|
-
},
|
|
23
|
-
fontSize: { default: 20 },
|
|
24
|
-
textPosition: { default: "bottom" },
|
|
25
|
-
lineColor: { default: "#000000" },
|
|
26
|
-
background: { default: "#FFFFFF" },
|
|
27
|
-
showBorder: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: true
|
|
30
|
-
},
|
|
31
|
-
label: { default: "" },
|
|
32
|
-
showLabel: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
emits: ["error"],
|
|
38
|
-
setup(__props, { emit: __emit }) {
|
|
39
|
-
const props = __props;
|
|
40
|
-
const emit = __emit;
|
|
41
|
-
const barcodeProps = computed(() => ({
|
|
42
|
-
value: props.value,
|
|
43
|
-
format: props.format,
|
|
44
|
-
width: props.width,
|
|
45
|
-
height: props.height,
|
|
46
|
-
displayValue: props.showText,
|
|
47
|
-
fontSize: props.fontSize,
|
|
48
|
-
textPosition: props.textPosition,
|
|
49
|
-
lineColor: props.lineColor,
|
|
50
|
-
background: props.background
|
|
51
|
-
}));
|
|
52
|
-
const handleError = (error) => {
|
|
53
|
-
console.error("条形码生成失败:", error);
|
|
54
|
-
emit("error", error);
|
|
55
|
-
};
|
|
56
|
-
return (_ctx, _cache) => {
|
|
57
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", { class: normalizeClass(["barcode-wrapper", { "with-border": _ctx.showBorder }]) }, [createVNode(unref(VueBarcode), mergeProps(barcodeProps.value, { onError: handleError }), null, 16)], 2), _ctx.showLabel && _ctx.label ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.label), 1)) : createCommentVNode("v-if", true)]);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/components/C_Barcode/index.vue
|
|
64
|
-
var C_Barcode_default = /* @__PURE__ */ export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e44c361d"]]);
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { C_Barcode_default as t };
|
|
1
|
+
import{t as e}from"./export-helper.js";import{computed as t,createCommentVNode as n,createElementBlock as r,createElementVNode as i,createVNode as a,defineComponent as o,mergeProps as s,normalizeClass as c,openBlock as l,toDisplayString as u,unref as d}from"vue";import f from"@chenfengyuan/vue-barcode";const p={class:`c-barcode`},m={key:0,class:`barcode-label`};var h=e(o({name:`C_Barcode`,__name:`index`,props:{value:{},format:{default:`CODE128`},width:{default:2},height:{default:80},showText:{type:Boolean,default:!0},fontSize:{default:20},textPosition:{default:`bottom`},lineColor:{default:`#000000`},background:{default:`#FFFFFF`},showBorder:{type:Boolean,default:!0},label:{default:``},showLabel:{type:Boolean,default:!1}},emits:[`error`],setup(e,{emit:o}){let h=e,g=o,_=t(()=>({value:h.value,format:h.format,width:h.width,height:h.height,displayValue:h.showText,fontSize:h.fontSize,textPosition:h.textPosition,lineColor:h.lineColor,background:h.background})),v=e=>{console.error(`条形码生成失败:`,e),g(`error`,e)};return(e,t)=>(l(),r(`div`,p,[i(`div`,{class:c([`barcode-wrapper`,{"with-border":e.showBorder}])},[a(d(f),s(_.value,{onError:v}),null,16)],2),e.showLabel&&e.label?(l(),r(`div`,m,u(e.label),1)):n(`v-if`,!0)]))}}),[[`__scopeId`,`data-v-e44c361d`]]);export{h as t};
|
|
68
2
|
//# sourceMappingURL=C_Barcode2.js.map
|
package/dist/C_Barcode2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C_Barcode2.js","names":["showBorder","showLabel","label"],"sources":["../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"C_Barcode2.js","names":["showBorder","showLabel","label"],"sources":["../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue","../src/components/C_Barcode/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-12-02\r\n * @Description: 条形码组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-barcode\">\r\n <div class=\"barcode-wrapper\" :class=\"{ 'with-border': showBorder }\">\r\n <VueBarcode v-bind=\"barcodeProps\" @error=\"handleError\" />\r\n </div>\r\n <div v-if=\"showLabel && label\" class=\"barcode-label\">\r\n {{ label }}\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from \"vue\";\r\nimport VueBarcode from \"@chenfengyuan/vue-barcode\";\r\n\r\ndefineOptions({ name: \"C_Barcode\" });\r\n\r\ninterface Props {\r\n value: string;\r\n format?:\r\n | \"CODE128\"\r\n | \"CODE39\"\r\n | \"EAN13\"\r\n | \"EAN8\"\r\n | \"UPC\"\r\n | \"ITF14\"\r\n | \"MSI\"\r\n | \"pharmacode\";\r\n width?: number;\r\n height?: number;\r\n showText?: boolean;\r\n fontSize?: number;\r\n textPosition?: \"bottom\" | \"top\";\r\n lineColor?: string;\r\n background?: string;\r\n showBorder?: boolean;\r\n label?: string;\r\n showLabel?: boolean;\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n format: \"CODE128\",\r\n width: 2,\r\n height: 80,\r\n showText: true,\r\n fontSize: 20,\r\n textPosition: \"bottom\",\r\n lineColor: \"#000000\",\r\n background: \"#FFFFFF\",\r\n showBorder: true,\r\n label: \"\",\r\n showLabel: false,\r\n});\r\n\r\nconst emit = defineEmits<{\r\n error: [error: Error];\r\n}>();\r\n\r\nconst barcodeProps = computed(() => ({\r\n value: props.value,\r\n format: props.format,\r\n width: props.width,\r\n height: props.height,\r\n displayValue: props.showText,\r\n fontSize: props.fontSize,\r\n textPosition: props.textPosition,\r\n lineColor: props.lineColor,\r\n background: props.background,\r\n}));\r\n\r\nconst handleError = (error: Error) => {\r\n console.error(\"条形码生成失败:\", error);\r\n emit(\"error\", error);\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":"6vBE+CA,IAAM,EAAQ,EAcR,EAAO,EAIP,EAAe,OAAgB,CACnC,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,aAAc,EAAM,SACpB,SAAU,EAAM,SAChB,aAAc,EAAM,aACpB,UAAW,EAAM,UACjB,WAAY,EAAM,WACnB,EAAE,CAEG,EAAe,GAAiB,CACpC,QAAQ,MAAM,WAAY,EAAM,CAChC,EAAK,QAAS,EAAM,oBAvEpB,EAOM,MAPN,EAOM,CANJ,EAEM,MAAA,CAFD,MAAK,EAAA,CAAC,kBAAiB,CAAA,cAA0BA,EAAAA,WAAU,CAAA,CAAA,CAAA,CAAA,CAC9D,EAAyD,EAAA,EAAA,CAAzD,EAAoB,EAAqC,MAAzB,CAAG,QAAO,EAAW,CAAA,CAAA,KAAA,GAAA,CAAA,CAAA,EAAA,CAE5CC,EAAAA,WAAaC,EAAAA,OAAAA,GAAAA,CAAxB,EAEM,MAFN,EAEM,EADDA,EAAAA,MAAK,CAAA,EAAA,EAAA,EAAA,OAAA,GAAA,CAAA,CAAA"}
|
package/dist/C_Captcha.cjs
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_C_Captcha = require('./C_Captcha.js');
|
|
3
|
-
|
|
4
|
-
exports.C_Captcha = require_C_Captcha.C_Captcha_default;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./C_Captcha.js`);exports.C_Captcha=e.t;
|
package/dist/C_Captcha.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"C_Captcha.js","names":["disabled","triggerText"],"sources":["../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":"qnBEqEA,IAAM,EAAQ,EAOR,EAAO,EAEP,GAAA,EAAA,EAAA,KAAgB,GAAM,CACtB,GAAA,EAAA,EAAA,KAAiB,GAAM,CACvB,GAAA,EAAA,EAAA,KAAe,GAAM,CACrB,GAAA,EAAA,EAAA,KAAwB,GAAG,CAC7B,EAAmD,KAEjD,GAAA,EAAA,EAAA,cACJ,EAAM,OAAO,OAAS,EAAI,EAAM,OAAS,IAAA,GAC1C,CAEK,MAAoB,CACpB,EAAM,UAAY,EAAW,QACjC,EAAS,MAAQ,GACjB,EAAU,MAAQ,KAGd,MAAsB,CAC1B,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GAClB,IAAM,EAAY,KAAK,KAAK,CACtB,EAAQ,UAAU,EAAU,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,UAAU,EAAG,EAAE,GAC/E,EAAkB,MAAQ,EAC1B,EAAK,UAAW,CAAE,QAAO,YAAW,CAAC,CACrC,EAAK,SAAU,GAAK,EAGhB,MAAmB,CACvB,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GACd,GAAY,aAAa,EAAW,CACxC,EAAa,eAAiB,CAC5B,EAAS,MAAQ,GACjB,EAAa,MACZ,IAAK,CACR,EAAK,OAAQ,SAAS,CACtB,EAAK,SAAU,GAAM,EAGjB,MAAoB,CACxB,EAAU,MAAQ,IAGd,MAAqB,CACzB,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GAClB,EAAkB,MAAQ,GAC1B,AAEE,KADA,aAAa,EAAW,CACX,MAEf,EAAK,QAAQ,CACb,EAAK,SAAU,GAAM,SAGvB,EAAa,CACX,aAAgB,EAAW,MAC3B,aAAgB,EAAkB,MAClC,wBACO,EAAW,MACT,CACL,MAAO,EAAkB,MACzB,UAAW,KAAK,KAAK,CACrB,KAAM,iBACP,CAL6B,KAOhC,MAAO,EACP,KAAM,EACP,CAAC,EAEF,EAAA,EAAA,qBAAsB,CAChB,GAAY,aAAa,EAAW,EACxC,oDA1GM,MAtCN,EAsCM,EAAA,EAAA,EAAA,oBARE,MAAA,CA5BJ,OAAA,EAAA,EAAA,gBAAK,CAAC,kBAAiB,UAEM,EAAA,YAA4B,EAAA,eAA6BA,EAAAA,YADrF,QAAO,6BAkBF,MAXN,EAWM,EAAA,EAAA,EAAA,oBANE,MAJN,EAIM,EAHS,EAAA,OAAU,CAAK,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAAmB,OAAA,EAAT,KAAE,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CAC5B,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAAyC,OAArD,EAA6C,IAAC,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CAClC,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAAsC,OAAlD,EAAyC,KAAE,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,4BAMvC,MAJN,EAIM,EAHS,EAAA,OAAU,CAAK,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAAkC,OAAA,GAAA,EAAA,EAAA,iBAArBC,EAAAA,YAAW,CAAA,EAAA,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CACxC,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAA4C,OAAxD,EAA6C,OAAI,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CACrC,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAA4C,OAAxD,EAAyC,WAAQ,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,KAI7C,EAAA,OAAc,EAAA,QAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAMhB,MAAA,OALJ,MAAM,iBACL,SAAA,EAAA,EAAA,eAAY,EAAY,CAAA,OAAA,CAAA,CACzB,MAAM,QACP,MAED,GAAA,EAAA,EAAA,oBAAA,OAAA,GAAA,CAAA,CAAA,EAAA,EAAA,EAAA,EAAA,cAAA,EAAA,EAAA,OAQA,EAAA,QAAA,CAAA,CALC,KAAM,EAAA,MACN,KAAM,EAAA,MACN,UAAS,EACT,QAAO,EACP,OAAM"}
|
package/dist/C_Captcha2.js
CHANGED
|
@@ -1,155 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, onBeforeUnmount, openBlock, ref, toDisplayString, unref, withModifiers } from "vue";
|
|
3
|
-
import PuzzleVcode from "vue3-puzzle-vcode";
|
|
4
|
-
|
|
5
|
-
//#region src/components/C_Captcha/index.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
const _hoisted_1 = { class: "c-captcha-modern" };
|
|
7
|
-
const _hoisted_2 = { class: "captcha-content" };
|
|
8
|
-
const _hoisted_3 = { class: "captcha-icon" };
|
|
9
|
-
const _hoisted_4 = { key: 0 };
|
|
10
|
-
const _hoisted_5 = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "success-icon"
|
|
13
|
-
};
|
|
14
|
-
const _hoisted_6 = {
|
|
15
|
-
key: 2,
|
|
16
|
-
class: "error-icon"
|
|
17
|
-
};
|
|
18
|
-
const _hoisted_7 = { class: "captcha-text" };
|
|
19
|
-
const _hoisted_8 = { key: 0 };
|
|
20
|
-
const _hoisted_9 = {
|
|
21
|
-
key: 1,
|
|
22
|
-
class: "success-text"
|
|
23
|
-
};
|
|
24
|
-
const _hoisted_10 = {
|
|
25
|
-
key: 2,
|
|
26
|
-
class: "error-text"
|
|
27
|
-
};
|
|
28
|
-
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
29
|
-
name: "C_Captcha",
|
|
30
|
-
__name: "index",
|
|
31
|
-
props: {
|
|
32
|
-
triggerText: { default: "点击进行人机验证" },
|
|
33
|
-
images: { default: () => [] },
|
|
34
|
-
disabled: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
theme: { default: "dark" }
|
|
39
|
-
},
|
|
40
|
-
emits: [
|
|
41
|
-
"success",
|
|
42
|
-
"fail",
|
|
43
|
-
"change",
|
|
44
|
-
"reset"
|
|
45
|
-
],
|
|
46
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
47
|
-
const props = __props;
|
|
48
|
-
const emit = __emit;
|
|
49
|
-
const showModal = ref(false);
|
|
50
|
-
const isVerified = ref(false);
|
|
51
|
-
const hasError = ref(false);
|
|
52
|
-
const verificationToken = ref("");
|
|
53
|
-
let errorTimer = null;
|
|
54
|
-
const captchaImages = computed(() => props.images.length > 0 ? props.images : void 0);
|
|
55
|
-
const showCaptcha = () => {
|
|
56
|
-
if (props.disabled || isVerified.value) return;
|
|
57
|
-
hasError.value = false;
|
|
58
|
-
showModal.value = true;
|
|
59
|
-
};
|
|
60
|
-
const handleSuccess = () => {
|
|
61
|
-
isVerified.value = true;
|
|
62
|
-
hasError.value = false;
|
|
63
|
-
showModal.value = false;
|
|
64
|
-
const timestamp = Date.now();
|
|
65
|
-
const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;
|
|
66
|
-
verificationToken.value = token;
|
|
67
|
-
emit("success", {
|
|
68
|
-
token,
|
|
69
|
-
timestamp
|
|
70
|
-
});
|
|
71
|
-
emit("change", true);
|
|
72
|
-
};
|
|
73
|
-
const handleFail = () => {
|
|
74
|
-
isVerified.value = false;
|
|
75
|
-
hasError.value = true;
|
|
76
|
-
showModal.value = false;
|
|
77
|
-
if (errorTimer) clearTimeout(errorTimer);
|
|
78
|
-
errorTimer = setTimeout(() => {
|
|
79
|
-
hasError.value = false;
|
|
80
|
-
errorTimer = null;
|
|
81
|
-
}, 3e3);
|
|
82
|
-
emit("fail", "拼图验证失败");
|
|
83
|
-
emit("change", false);
|
|
84
|
-
};
|
|
85
|
-
const handleClose = () => {
|
|
86
|
-
showModal.value = false;
|
|
87
|
-
};
|
|
88
|
-
const resetCaptcha = () => {
|
|
89
|
-
isVerified.value = false;
|
|
90
|
-
hasError.value = false;
|
|
91
|
-
showModal.value = false;
|
|
92
|
-
verificationToken.value = "";
|
|
93
|
-
if (errorTimer) {
|
|
94
|
-
clearTimeout(errorTimer);
|
|
95
|
-
errorTimer = null;
|
|
96
|
-
}
|
|
97
|
-
emit("reset");
|
|
98
|
-
emit("change", false);
|
|
99
|
-
};
|
|
100
|
-
__expose({
|
|
101
|
-
validate: () => isVerified.value,
|
|
102
|
-
getToken: () => verificationToken.value,
|
|
103
|
-
getVerificationData: () => {
|
|
104
|
-
if (!isVerified.value) return null;
|
|
105
|
-
return {
|
|
106
|
-
token: verificationToken.value,
|
|
107
|
-
timestamp: Date.now(),
|
|
108
|
-
type: "puzzle-captcha"
|
|
109
|
-
};
|
|
110
|
-
},
|
|
111
|
-
reset: resetCaptcha,
|
|
112
|
-
show: showCaptcha
|
|
113
|
-
});
|
|
114
|
-
onBeforeUnmount(() => {
|
|
115
|
-
if (errorTimer) clearTimeout(errorTimer);
|
|
116
|
-
});
|
|
117
|
-
return (_ctx, _cache) => {
|
|
118
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
119
|
-
class: normalizeClass(["captcha-trigger", {
|
|
120
|
-
verified: isVerified.value,
|
|
121
|
-
error: hasError.value,
|
|
122
|
-
disabled: _ctx.disabled
|
|
123
|
-
}]),
|
|
124
|
-
onClick: showCaptcha
|
|
125
|
-
}, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [
|
|
126
|
-
!isVerified.value && !hasError.value ? (openBlock(), createElementBlock("span", _hoisted_4, "🧩")) : createCommentVNode("v-if", true),
|
|
127
|
-
isVerified.value ? (openBlock(), createElementBlock("span", _hoisted_5, "✓")) : createCommentVNode("v-if", true),
|
|
128
|
-
hasError.value ? (openBlock(), createElementBlock("span", _hoisted_6, "⚠️")) : createCommentVNode("v-if", true)
|
|
129
|
-
]), createElementVNode("div", _hoisted_7, [
|
|
130
|
-
!isVerified.value && !hasError.value ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(_ctx.triggerText), 1)) : createCommentVNode("v-if", true),
|
|
131
|
-
isVerified.value ? (openBlock(), createElementBlock("span", _hoisted_9, "验证成功")) : createCommentVNode("v-if", true),
|
|
132
|
-
hasError.value ? (openBlock(), createElementBlock("span", _hoisted_10, "验证失败,请重试")) : createCommentVNode("v-if", true)
|
|
133
|
-
])]), isVerified.value || hasError.value ? (openBlock(), createElementBlock("div", {
|
|
134
|
-
key: 0,
|
|
135
|
-
class: "refresh-button",
|
|
136
|
-
onClick: withModifiers(resetCaptcha, ["stop"]),
|
|
137
|
-
title: "重新验证"
|
|
138
|
-
}, " ⟲ ")) : createCommentVNode("v-if", true)], 2), createVNode(unref(PuzzleVcode), {
|
|
139
|
-
show: showModal.value,
|
|
140
|
-
imgs: captchaImages.value,
|
|
141
|
-
onSuccess: handleSuccess,
|
|
142
|
-
onClose: handleClose,
|
|
143
|
-
onFail: handleFail
|
|
144
|
-
}, null, 8, ["show", "imgs"])]);
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/components/C_Captcha/index.vue
|
|
151
|
-
var C_Captcha_default = /* @__PURE__ */ export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-74f1f0d1"]]);
|
|
152
|
-
|
|
153
|
-
//#endregion
|
|
154
|
-
export { C_Captcha_default as t };
|
|
1
|
+
import{t as e}from"./export-helper.js";import{computed as t,createCommentVNode as n,createElementBlock as r,createElementVNode as i,createVNode as a,defineComponent as o,normalizeClass as s,onBeforeUnmount as c,openBlock as l,ref as u,toDisplayString as d,unref as f,withModifiers as p}from"vue";import m from"vue3-puzzle-vcode";const h={class:`c-captcha-modern`},g={class:`captcha-content`},_={class:`captcha-icon`},v={key:0},y={key:1,class:`success-icon`},b={key:2,class:`error-icon`},x={class:`captcha-text`},S={key:0},C={key:1,class:`success-text`},w={key:2,class:`error-text`};var T=e(o({name:`C_Captcha`,__name:`index`,props:{triggerText:{default:`点击进行人机验证`},images:{default:()=>[]},disabled:{type:Boolean,default:!1},theme:{default:`dark`}},emits:[`success`,`fail`,`change`,`reset`],setup(e,{expose:o,emit:T}){let E=e,D=T,O=u(!1),k=u(!1),A=u(!1),j=u(``),M=null,N=t(()=>E.images.length>0?E.images:void 0),P=()=>{E.disabled||k.value||(A.value=!1,O.value=!0)},F=()=>{k.value=!0,A.value=!1,O.value=!1;let e=Date.now(),t=`puzzle_${e}_${Math.random().toString(36).substring(2,9)}`;j.value=t,D(`success`,{token:t,timestamp:e}),D(`change`,!0)},I=()=>{k.value=!1,A.value=!0,O.value=!1,M&&clearTimeout(M),M=setTimeout(()=>{A.value=!1,M=null},3e3),D(`fail`,`拼图验证失败`),D(`change`,!1)},L=()=>{O.value=!1},R=()=>{k.value=!1,A.value=!1,O.value=!1,j.value=``,M&&=(clearTimeout(M),null),D(`reset`),D(`change`,!1)};return o({validate:()=>k.value,getToken:()=>j.value,getVerificationData:()=>k.value?{token:j.value,timestamp:Date.now(),type:`puzzle-captcha`}:null,reset:R,show:P}),c(()=>{M&&clearTimeout(M)}),(e,t)=>(l(),r(`div`,h,[i(`div`,{class:s([`captcha-trigger`,{verified:k.value,error:A.value,disabled:e.disabled}]),onClick:P},[i(`div`,g,[i(`div`,_,[!k.value&&!A.value?(l(),r(`span`,v,`🧩`)):n(`v-if`,!0),k.value?(l(),r(`span`,y,`✓`)):n(`v-if`,!0),A.value?(l(),r(`span`,b,`⚠️`)):n(`v-if`,!0)]),i(`div`,x,[!k.value&&!A.value?(l(),r(`span`,S,d(e.triggerText),1)):n(`v-if`,!0),k.value?(l(),r(`span`,C,`验证成功`)):n(`v-if`,!0),A.value?(l(),r(`span`,w,`验证失败,请重试`)):n(`v-if`,!0)])]),k.value||A.value?(l(),r(`div`,{key:0,class:`refresh-button`,onClick:p(R,[`stop`]),title:`重新验证`},` ⟲ `)):n(`v-if`,!0)],2),a(f(m),{show:O.value,imgs:N.value,onSuccess:F,onClose:L,onFail:I},null,8,[`show`,`imgs`])]))}}),[[`__scopeId`,`data-v-74f1f0d1`]]);export{T as t};
|
|
155
2
|
//# sourceMappingURL=C_Captcha2.js.map
|
package/dist/C_Captcha2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C_Captcha2.js","names":["disabled","triggerText"],"sources":["../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECqEA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAEb,MAAM,YAAY,IAAI,MAAM;EAC5B,MAAM,aAAa,IAAI,MAAM;EAC7B,MAAM,WAAW,IAAI,MAAM;EAC3B,MAAM,oBAAoB,IAAI,GAAG;EACjC,IAAI,aAAmD;EAEvD,MAAM,gBAAgB,eACpB,MAAM,OAAO,SAAS,IAAI,MAAM,SAAS,OAC1C;EAED,MAAM,oBAAoB;AACxB,OAAI,MAAM,YAAY,WAAW,MAAO;AACxC,YAAS,QAAQ;AACjB,aAAU,QAAQ;;EAGpB,MAAM,sBAAsB;AAC1B,cAAW,QAAQ;AACnB,YAAS,QAAQ;AACjB,aAAU,QAAQ;GAClB,MAAM,YAAY,KAAK,KAAK;GAC5B,MAAM,QAAQ,UAAU,UAAU,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,UAAU,GAAG,EAAE;AAC/E,qBAAkB,QAAQ;AAC1B,QAAK,WAAW;IAAE;IAAO;IAAW,CAAC;AACrC,QAAK,UAAU,KAAK;;EAGtB,MAAM,mBAAmB;AACvB,cAAW,QAAQ;AACnB,YAAS,QAAQ;AACjB,aAAU,QAAQ;AAClB,OAAI,WAAY,cAAa,WAAW;AACxC,gBAAa,iBAAiB;AAC5B,aAAS,QAAQ;AACjB,iBAAa;MACZ,IAAK;AACR,QAAK,QAAQ,SAAS;AACtB,QAAK,UAAU,MAAM;;EAGvB,MAAM,oBAAoB;AACxB,aAAU,QAAQ;;EAGpB,MAAM,qBAAqB;AACzB,cAAW,QAAQ;AACnB,YAAS,QAAQ;AACjB,aAAU,QAAQ;AAClB,qBAAkB,QAAQ;AAC1B,OAAI,YAAY;AACd,iBAAa,WAAW;AACxB,iBAAa;;AAEf,QAAK,QAAQ;AACb,QAAK,UAAU,MAAM;;AAGvB,WAAa;GACX,gBAAgB,WAAW;GAC3B,gBAAgB,kBAAkB;GAClC,2BAA2B;AACzB,QAAI,CAAC,WAAW,MAAO,QAAO;AAC9B,WAAO;KACL,OAAO,kBAAkB;KACzB,WAAW,KAAK,KAAK;KACrB,MAAM;KACP;;GAEH,OAAO;GACP,MAAM;GACP,CAAC;AAEF,wBAAsB;AACpB,OAAI,WAAY,cAAa,WAAW;IACxC;;uBAhJA,mBAsCM,OAtCN,YAsCM,CArCJ,mBA6BM,OAAA;IA5BJ,OAAK,eAAA,CAAC,mBAAiB;eAEM,WAAA;YAA4B,SAAA;eAA6BA,KAAAA;;IADrF,SAAO;OAOR,mBAWM,OAXN,YAWM,CAVJ,mBAIM,OAJN,YAIM;KAHS,WAAA,SAAU,CAAK,SAAA,sBAA5B,mBAA+C,QAAA,YAAT,KAAE;IAC5B,WAAA,sBAAZ,mBAAqD,QAArD,YAA6C,IAAC;IAClC,SAAA,sBAAZ,mBAAkD,QAAlD,YAAyC,KAAE;OAE7C,mBAIM,OAJN,YAIM;KAHS,WAAA,SAAU,CAAK,SAAA,sBAA5B,mBAA8D,QAAA,YAAA,gBAArBC,KAAAA,YAAW,EAAA,EAAA;IACxC,WAAA,sBAAZ,mBAAwD,QAAxD,YAA6C,OAAI;IACrC,SAAA,sBAAZ,mBAAwD,QAAxD,aAAyC,WAAQ;SAI7C,WAAA,SAAc,SAAA,sBADtB,mBAOM,OAAA;;IALJ,OAAM;IACL,SAAK,cAAO,cAAY,CAAA,OAAA,CAAA;IACzB,OAAM;MACP,MAED,2CAEF,YAME,MAAA,YAAA,EAAA;IALC,MAAM,UAAA;IACN,MAAM,cAAA;IACN,WAAS;IACT,SAAO;IACP,QAAM"}
|
|
1
|
+
{"version":3,"file":"C_Captcha2.js","names":["disabled","triggerText"],"sources":["../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue","../src/components/C_Captcha/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-07-23\r\n * @Description: 基于 vue3-puzzle-vcode 封装的验证器组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"c-captcha-modern\">\r\n <div\r\n class=\"captcha-trigger\"\r\n @click=\"showCaptcha\"\r\n :class=\"{\r\n verified: isVerified,\r\n error: hasError,\r\n disabled: disabled,\r\n }\"\r\n >\r\n <div class=\"captcha-content\">\r\n <div class=\"captcha-icon\">\r\n <span v-if=\"!isVerified && !hasError\">🧩</span>\r\n <span v-if=\"isVerified\" class=\"success-icon\">✓</span>\r\n <span v-if=\"hasError\" class=\"error-icon\">⚠️</span>\r\n </div>\r\n <div class=\"captcha-text\">\r\n <span v-if=\"!isVerified && !hasError\">{{ triggerText }}</span>\r\n <span v-if=\"isVerified\" class=\"success-text\">验证成功</span>\r\n <span v-if=\"hasError\" class=\"error-text\">验证失败,请重试</span>\r\n </div>\r\n </div>\r\n <div\r\n v-if=\"isVerified || hasError\"\r\n class=\"refresh-button\"\r\n @click.stop=\"resetCaptcha\"\r\n title=\"重新验证\"\r\n >\r\n ⟲\r\n </div>\r\n </div>\r\n <PuzzleVcode\r\n :show=\"showModal\"\r\n :imgs=\"captchaImages\"\r\n @success=\"handleSuccess\"\r\n @close=\"handleClose\"\r\n @fail=\"handleFail\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ref, computed, onBeforeUnmount } from \"vue\";\r\nimport PuzzleVcode from \"vue3-puzzle-vcode\";\r\n\r\ndefineOptions({ name: \"C_Captcha\" });\r\n\r\ninterface CaptchaProps {\r\n triggerText?: string;\r\n images?: string[];\r\n disabled?: boolean;\r\n theme?: \"light\" | \"dark\";\r\n}\r\n\r\ninterface CaptchaEmits {\r\n (e: \"success\", data: { token: string; timestamp: number }): void;\r\n (e: \"fail\", error: string): void;\r\n (e: \"change\", valid: boolean): void;\r\n (e: \"reset\"): void;\r\n}\r\n\r\nconst props = withDefaults(defineProps<CaptchaProps>(), {\r\n triggerText: \"点击进行人机验证\",\r\n images: () => [],\r\n disabled: false,\r\n theme: \"dark\",\r\n});\r\n\r\nconst emit = defineEmits<CaptchaEmits>();\r\n\r\nconst showModal = ref(false);\r\nconst isVerified = ref(false);\r\nconst hasError = ref(false);\r\nconst verificationToken = ref(\"\");\r\nlet errorTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\nconst captchaImages = computed(() =>\r\n props.images.length > 0 ? props.images : undefined,\r\n);\r\n\r\nconst showCaptcha = () => {\r\n if (props.disabled || isVerified.value) return;\r\n hasError.value = false;\r\n showModal.value = true;\r\n};\r\n\r\nconst handleSuccess = () => {\r\n isVerified.value = true;\r\n hasError.value = false;\r\n showModal.value = false;\r\n const timestamp = Date.now();\r\n const token = `puzzle_${timestamp}_${Math.random().toString(36).substring(2, 9)}`;\r\n verificationToken.value = token;\r\n emit(\"success\", { token, timestamp });\r\n emit(\"change\", true);\r\n};\r\n\r\nconst handleFail = () => {\r\n isVerified.value = false;\r\n hasError.value = true;\r\n showModal.value = false;\r\n if (errorTimer) clearTimeout(errorTimer);\r\n errorTimer = setTimeout(() => {\r\n hasError.value = false;\r\n errorTimer = null;\r\n }, 3000);\r\n emit(\"fail\", \"拼图验证失败\");\r\n emit(\"change\", false);\r\n};\r\n\r\nconst handleClose = () => {\r\n showModal.value = false;\r\n};\r\n\r\nconst resetCaptcha = () => {\r\n isVerified.value = false;\r\n hasError.value = false;\r\n showModal.value = false;\r\n verificationToken.value = \"\";\r\n if (errorTimer) {\r\n clearTimeout(errorTimer);\r\n errorTimer = null;\r\n }\r\n emit(\"reset\");\r\n emit(\"change\", false);\r\n};\r\n\r\ndefineExpose({\r\n validate: () => isVerified.value,\r\n getToken: () => verificationToken.value,\r\n getVerificationData: () => {\r\n if (!isVerified.value) return null;\r\n return {\r\n token: verificationToken.value,\r\n timestamp: Date.now(),\r\n type: \"puzzle-captcha\",\r\n };\r\n },\r\n reset: resetCaptcha,\r\n show: showCaptcha,\r\n});\r\n\r\nonBeforeUnmount(() => {\r\n if (errorTimer) clearTimeout(errorTimer);\r\n});\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n@use \"./index.scss\";\r\n</style>\r\n"],"mappings":"izBEqEA,IAAM,EAAQ,EAOR,EAAO,EAEP,EAAY,EAAI,GAAM,CACtB,EAAa,EAAI,GAAM,CACvB,EAAW,EAAI,GAAM,CACrB,EAAoB,EAAI,GAAG,CAC7B,EAAmD,KAEjD,EAAgB,MACpB,EAAM,OAAO,OAAS,EAAI,EAAM,OAAS,IAAA,GAC1C,CAEK,MAAoB,CACpB,EAAM,UAAY,EAAW,QACjC,EAAS,MAAQ,GACjB,EAAU,MAAQ,KAGd,MAAsB,CAC1B,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GAClB,IAAM,EAAY,KAAK,KAAK,CACtB,EAAQ,UAAU,EAAU,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,UAAU,EAAG,EAAE,GAC/E,EAAkB,MAAQ,EAC1B,EAAK,UAAW,CAAE,QAAO,YAAW,CAAC,CACrC,EAAK,SAAU,GAAK,EAGhB,MAAmB,CACvB,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GACd,GAAY,aAAa,EAAW,CACxC,EAAa,eAAiB,CAC5B,EAAS,MAAQ,GACjB,EAAa,MACZ,IAAK,CACR,EAAK,OAAQ,SAAS,CACtB,EAAK,SAAU,GAAM,EAGjB,MAAoB,CACxB,EAAU,MAAQ,IAGd,MAAqB,CACzB,EAAW,MAAQ,GACnB,EAAS,MAAQ,GACjB,EAAU,MAAQ,GAClB,EAAkB,MAAQ,GAC1B,AAEE,KADA,aAAa,EAAW,CACX,MAEf,EAAK,QAAQ,CACb,EAAK,SAAU,GAAM,SAGvB,EAAa,CACX,aAAgB,EAAW,MAC3B,aAAgB,EAAkB,MAClC,wBACO,EAAW,MACT,CACL,MAAO,EAAkB,MACzB,UAAW,KAAK,KAAK,CACrB,KAAM,iBACP,CAL6B,KAOhC,MAAO,EACP,KAAM,EACP,CAAC,CAEF,MAAsB,CAChB,GAAY,aAAa,EAAW,EACxC,aAhJA,EAsCM,MAtCN,EAsCM,CArCJ,EA6BM,MAAA,CA5BJ,MAAK,EAAA,CAAC,kBAAiB,UAEM,EAAA,YAA4B,EAAA,eAA6BA,EAAAA,YADrF,QAAO,IAOR,EAWM,MAXN,EAWM,CAVJ,EAIM,MAJN,EAIM,EAHS,EAAA,OAAU,CAAK,EAAA,OAAA,GAAA,CAA5B,EAA+C,OAAA,EAAT,KAAE,EAAA,EAAA,OAAA,GAAA,CAC5B,EAAA,OAAA,GAAA,CAAZ,EAAqD,OAArD,EAA6C,IAAC,EAAA,EAAA,OAAA,GAAA,CAClC,EAAA,OAAA,GAAA,CAAZ,EAAkD,OAAlD,EAAyC,KAAE,EAAA,EAAA,OAAA,GAAA,GAE7C,EAIM,MAJN,EAIM,EAHS,EAAA,OAAU,CAAK,EAAA,OAAA,GAAA,CAA5B,EAA8D,OAAA,EAAA,EAArBC,EAAAA,YAAW,CAAA,EAAA,EAAA,EAAA,OAAA,GAAA,CACxC,EAAA,OAAA,GAAA,CAAZ,EAAwD,OAAxD,EAA6C,OAAI,EAAA,EAAA,OAAA,GAAA,CACrC,EAAA,OAAA,GAAA,CAAZ,EAAwD,OAAxD,EAAyC,WAAQ,EAAA,EAAA,OAAA,GAAA,KAI7C,EAAA,OAAc,EAAA,OAAA,GAAA,CADtB,EAOM,MAAA,OALJ,MAAM,iBACL,QAAK,EAAO,EAAY,CAAA,OAAA,CAAA,CACzB,MAAM,QACP,MAED,EAAA,EAAA,OAAA,GAAA,CAAA,CAAA,EAAA,CAEF,EAME,EAAA,EAAA,CAAA,CALC,KAAM,EAAA,MACN,KAAM,EAAA,MACN,UAAS,EACT,QAAO,EACP,OAAM"}
|
package/dist/C_Cascade.cjs
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_C_Cascade = require('./C_Cascade.js');
|
|
3
|
-
|
|
4
|
-
exports.C_Cascade = require_C_Cascade.C_Cascade_default;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./C_Cascade.js`);exports.C_Cascade=e.t;
|
package/dist/C_Cascade.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"C_Cascade.js","names":["placeholders"],"sources":["../src/components/C_Cascade/index.vue","../src/components/C_Cascade/index.vue","../src/components/C_Cascade/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-05-28\r\n * @Description: 级联选择组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"n-cascade-selector\">\r\n <NSelect\r\n v-for=\"(level, index) in levels\"\r\n :key=\"index\"\r\n v-model:value=\"selectedValues[index]\"\r\n :options=\"levelOptions[index]\"\r\n clearable\r\n :placeholder=\"placeholders[index]\"\r\n :disabled=\"index > 0 && !selectedValues[index - 1]\"\r\n @update:value=\"handleChange(index)\"\r\n class=\"n-select-item\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, computed, watch } from \"vue\";\r\nimport { NSelect } from \"naive-ui\";\r\n\r\ndefineOptions({ name: \"C_Cascade\" });\r\n\r\nexport interface CascadeItem {\r\n label: string;\r\n value: string | number;\r\n children?: CascadeItem[];\r\n}\r\n\r\ninterface CascadeValue {\r\n primary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n secondary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n tertiary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n}\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n data: CascadeItem[];\r\n placeholders?: string[];\r\n modelValue?: CascadeValue;\r\n }>(),\r\n {\r\n placeholders: () => [\"请选择\", \"请选择\", \"请选择\"],\r\n },\r\n);\r\n\r\nconst emit = defineEmits<{\r\n \"update:modelValue\": [value: CascadeValue];\r\n change: [value: CascadeValue];\r\n}>();\r\n\r\nconst levels = [0, 1, 2];\r\nconst selectedValues = ref<(string | number | null)[]>([null, null, null]);\r\n\r\nconst getLevelData = (level: number): CascadeItem[] => {\r\n if (level === 0) return props.data;\r\n if (!selectedValues.value[level - 1]) return [];\r\n const parentData = getLevelData(level - 1);\r\n return (\r\n parentData.find((x) => x.value === selectedValues.value[level - 1])\r\n ?.children || []\r\n );\r\n};\r\n\r\nconst levelOptions = computed(() =>\r\n levels.map((level) =>\r\n getLevelData(level).map((item) => ({\r\n label: item.label,\r\n value: item.value,\r\n })),\r\n ),\r\n);\r\n\r\nconst handleChange = (index: number) => {\r\n selectedValues.value.splice(\r\n index + 1,\r\n levels.length - index - 1,\r\n ...Array(levels.length - index - 1).fill(null),\r\n );\r\n emitValue();\r\n};\r\n\r\nconst getSelectedItem = (index: number) => {\r\n const value = selectedValues.value[index];\r\n if (!value) return null;\r\n const data = getLevelData(index);\r\n const item = data.find((i) => i.value === value);\r\n return item ? { label: item.label, value: item.value } : null;\r\n};\r\n\r\nconst emitValue = () => {\r\n const result: CascadeValue = {\r\n primary: getSelectedItem(0),\r\n secondary: getSelectedItem(1),\r\n tertiary: getSelectedItem(2),\r\n };\r\n emit(\"update:modelValue\", result);\r\n emit(\"change\", result);\r\n};\r\n\r\nwatch(\r\n () => props.modelValue,\r\n (val) => {\r\n selectedValues.value = [\r\n val?.primary?.value ?? null,\r\n val?.secondary?.value ?? null,\r\n val?.tertiary?.value ?? null,\r\n ];\r\n },\r\n { immediate: true, deep: true },\r\n);\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.n-cascade-selector {\r\n display: flex;\r\n gap: 12px;\r\n .n-select-item {\r\n min-width: 140px;\r\n flex: 1;\r\n }\r\n}\r\n</style>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-05-28\r\n * @Description: 级联选择组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"n-cascade-selector\">\r\n <NSelect\r\n v-for=\"(level, index) in levels\"\r\n :key=\"index\"\r\n v-model:value=\"selectedValues[index]\"\r\n :options=\"levelOptions[index]\"\r\n clearable\r\n :placeholder=\"placeholders[index]\"\r\n :disabled=\"index > 0 && !selectedValues[index - 1]\"\r\n @update:value=\"handleChange(index)\"\r\n class=\"n-select-item\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, computed, watch } from \"vue\";\r\nimport { NSelect } from \"naive-ui\";\r\n\r\ndefineOptions({ name: \"C_Cascade\" });\r\n\r\nexport interface CascadeItem {\r\n label: string;\r\n value: string | number;\r\n children?: CascadeItem[];\r\n}\r\n\r\ninterface CascadeValue {\r\n primary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n secondary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n tertiary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n}\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n data: CascadeItem[];\r\n placeholders?: string[];\r\n modelValue?: CascadeValue;\r\n }>(),\r\n {\r\n placeholders: () => [\"请选择\", \"请选择\", \"请选择\"],\r\n },\r\n);\r\n\r\nconst emit = defineEmits<{\r\n \"update:modelValue\": [value: CascadeValue];\r\n change: [value: CascadeValue];\r\n}>();\r\n\r\nconst levels = [0, 1, 2];\r\nconst selectedValues = ref<(string | number | null)[]>([null, null, null]);\r\n\r\nconst getLevelData = (level: number): CascadeItem[] => {\r\n if (level === 0) return props.data;\r\n if (!selectedValues.value[level - 1]) return [];\r\n const parentData = getLevelData(level - 1);\r\n return (\r\n parentData.find((x) => x.value === selectedValues.value[level - 1])\r\n ?.children || []\r\n );\r\n};\r\n\r\nconst levelOptions = computed(() =>\r\n levels.map((level) =>\r\n getLevelData(level).map((item) => ({\r\n label: item.label,\r\n value: item.value,\r\n })),\r\n ),\r\n);\r\n\r\nconst handleChange = (index: number) => {\r\n selectedValues.value.splice(\r\n index + 1,\r\n levels.length - index - 1,\r\n ...Array(levels.length - index - 1).fill(null),\r\n );\r\n emitValue();\r\n};\r\n\r\nconst getSelectedItem = (index: number) => {\r\n const value = selectedValues.value[index];\r\n if (!value) return null;\r\n const data = getLevelData(index);\r\n const item = data.find((i) => i.value === value);\r\n return item ? { label: item.label, value: item.value } : null;\r\n};\r\n\r\nconst emitValue = () => {\r\n const result: CascadeValue = {\r\n primary: getSelectedItem(0),\r\n secondary: getSelectedItem(1),\r\n tertiary: getSelectedItem(2),\r\n };\r\n emit(\"update:modelValue\", result);\r\n emit(\"change\", result);\r\n};\r\n\r\nwatch(\r\n () => props.modelValue,\r\n (val) => {\r\n selectedValues.value = [\r\n val?.primary?.value ?? null,\r\n val?.secondary?.value ?? null,\r\n val?.tertiary?.value ?? null,\r\n ];\r\n },\r\n { immediate: true, deep: true },\r\n);\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.n-cascade-selector {\r\n display: flex;\r\n gap: 12px;\r\n .n-select-item {\r\n min-width: 140px;\r\n flex: 1;\r\n }\r\n}\r\n</style>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-05-28\r\n * @Description: 级联选择组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <div class=\"n-cascade-selector\">\r\n <NSelect\r\n v-for=\"(level, index) in levels\"\r\n :key=\"index\"\r\n v-model:value=\"selectedValues[index]\"\r\n :options=\"levelOptions[index]\"\r\n clearable\r\n :placeholder=\"placeholders[index]\"\r\n :disabled=\"index > 0 && !selectedValues[index - 1]\"\r\n @update:value=\"handleChange(index)\"\r\n class=\"n-select-item\"\r\n />\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, computed, watch } from \"vue\";\r\nimport { NSelect } from \"naive-ui\";\r\n\r\ndefineOptions({ name: \"C_Cascade\" });\r\n\r\nexport interface CascadeItem {\r\n label: string;\r\n value: string | number;\r\n children?: CascadeItem[];\r\n}\r\n\r\ninterface CascadeValue {\r\n primary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n secondary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n tertiary?: Pick<CascadeItem, \"label\" | \"value\"> | null;\r\n}\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n data: CascadeItem[];\r\n placeholders?: string[];\r\n modelValue?: CascadeValue;\r\n }>(),\r\n {\r\n placeholders: () => [\"请选择\", \"请选择\", \"请选择\"],\r\n },\r\n);\r\n\r\nconst emit = defineEmits<{\r\n \"update:modelValue\": [value: CascadeValue];\r\n change: [value: CascadeValue];\r\n}>();\r\n\r\nconst levels = [0, 1, 2];\r\nconst selectedValues = ref<(string | number | null)[]>([null, null, null]);\r\n\r\nconst getLevelData = (level: number): CascadeItem[] => {\r\n if (level === 0) return props.data;\r\n if (!selectedValues.value[level - 1]) return [];\r\n const parentData = getLevelData(level - 1);\r\n return (\r\n parentData.find((x) => x.value === selectedValues.value[level - 1])\r\n ?.children || []\r\n );\r\n};\r\n\r\nconst levelOptions = computed(() =>\r\n levels.map((level) =>\r\n getLevelData(level).map((item) => ({\r\n label: item.label,\r\n value: item.value,\r\n })),\r\n ),\r\n);\r\n\r\nconst handleChange = (index: number) => {\r\n selectedValues.value.splice(\r\n index + 1,\r\n levels.length - index - 1,\r\n ...Array(levels.length - index - 1).fill(null),\r\n );\r\n emitValue();\r\n};\r\n\r\nconst getSelectedItem = (index: number) => {\r\n const value = selectedValues.value[index];\r\n if (!value) return null;\r\n const data = getLevelData(index);\r\n const item = data.find((i) => i.value === value);\r\n return item ? { label: item.label, value: item.value } : null;\r\n};\r\n\r\nconst emitValue = () => {\r\n const result: CascadeValue = {\r\n primary: getSelectedItem(0),\r\n secondary: getSelectedItem(1),\r\n tertiary: getSelectedItem(2),\r\n };\r\n emit(\"update:modelValue\", result);\r\n emit(\"change\", result);\r\n};\r\n\r\nwatch(\r\n () => props.modelValue,\r\n (val) => {\r\n selectedValues.value = [\r\n val?.primary?.value ?? null,\r\n val?.secondary?.value ?? null,\r\n val?.tertiary?.value ?? null,\r\n ];\r\n },\r\n { immediate: true, deep: true },\r\n);\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.n-cascade-selector {\r\n display: flex;\r\n gap: 12px;\r\n .n-select-item {\r\n min-width: 140px;\r\n flex: 1;\r\n }\r\n}\r\n</style>\r\n"],"mappings":"6UEyCA,IAAM,EAAQ,EAWR,EAAO,EAKP,EAAS,CAAC,EAAG,EAAG,EAAE,CAClB,GAAA,EAAA,EAAA,KAAiD,CAAC,KAAM,KAAM,KAAK,CAAC,CAEpE,EAAgB,GAChB,IAAU,EAAU,EAAM,KACzB,EAAe,MAAM,EAAQ,IACf,EAAa,EAAQ,EAAE,CAE7B,KAAM,GAAM,EAAE,QAAU,EAAe,MAAM,EAAQ,GAAG,EAC/D,UAJuC,EAAE,CAQ3C,GAAA,EAAA,EAAA,cACJ,EAAO,IAAK,GACV,EAAa,EAAM,CAAC,IAAK,IAAU,CACjC,MAAO,EAAK,MACZ,MAAO,EAAK,MACb,EAAE,CACJ,CACF,CAEK,EAAgB,GAAkB,CACtC,EAAe,MAAM,OACnB,EAAQ,EACR,EAAO,OAAS,EAAQ,EACxB,GAAG,MAAM,EAAO,OAAS,EAAQ,EAAE,CAAC,KAAK,KAAK,CAC/C,CACD,GAAW,EAGP,EAAmB,GAAkB,CACzC,IAAM,EAAQ,EAAe,MAAM,GACnC,GAAI,CAAC,EAAO,OAAO,KAEnB,IAAM,EADO,EAAa,EAAM,CACd,KAAM,GAAM,EAAE,QAAU,EAAM,CAChD,OAAO,EAAO,CAAE,MAAO,EAAK,MAAO,MAAO,EAAK,MAAO,CAAG,MAGrD,MAAkB,CACtB,IAAM,EAAuB,CAC3B,QAAS,EAAgB,EAAE,CAC3B,UAAW,EAAgB,EAAE,CAC7B,SAAU,EAAgB,EAAE,CAC7B,CACD,EAAK,oBAAqB,EAAO,CACjC,EAAK,SAAU,EAAO,SAGxB,EAAA,EAAA,WACQ,EAAM,WACX,GAAQ,CACP,EAAe,MAAQ,CACrB,GAAK,SAAS,OAAS,KACvB,GAAK,WAAW,OAAS,KACzB,GAAK,UAAU,OAAS,KACzB,EAEH,CAAE,UAAW,GAAM,KAAM,GAAM,CAChC,oDAhGO,MAZN,EAYM,GAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBADF,EAAA,SAAA,MAAA,EAAA,EAAA,YATyB,GAAjB,EAAO,kCASf,EAAA,QAAA,CAAA,CARC,IAAK,EACE,MAAO,EAAA,MAAe,wBAAf,EAAA,MAAe,GAAK,EAAA,GAKpB,EAAa,EAAK,CAAA,CAJhC,QAAS,EAAA,MAAa,GACvB,UAAA,GACC,YAAaA,EAAAA,aAAa,GAC1B,SAAU,EAAK,GAAA,CAAS,EAAA,MAAe,EAAK,GAE7C,MAAM"}
|
package/dist/C_Cascade2.js
CHANGED
|
@@ -1,103 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { NSelect } from "naive-ui";
|
|
3
|
-
import { Fragment, computed, createElementBlock, createVNode, defineComponent, openBlock, ref, renderList, unref, watch } from "vue";
|
|
4
|
-
|
|
5
|
-
//#region src/components/C_Cascade/index.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
const _hoisted_1 = { class: "n-cascade-selector" };
|
|
7
|
-
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
8
|
-
name: "C_Cascade",
|
|
9
|
-
__name: "index",
|
|
10
|
-
props: {
|
|
11
|
-
data: {},
|
|
12
|
-
placeholders: { default: () => [
|
|
13
|
-
"请选择",
|
|
14
|
-
"请选择",
|
|
15
|
-
"请选择"
|
|
16
|
-
] },
|
|
17
|
-
modelValue: {}
|
|
18
|
-
},
|
|
19
|
-
emits: ["update:modelValue", "change"],
|
|
20
|
-
setup(__props, { emit: __emit }) {
|
|
21
|
-
const props = __props;
|
|
22
|
-
const emit = __emit;
|
|
23
|
-
const levels = [
|
|
24
|
-
0,
|
|
25
|
-
1,
|
|
26
|
-
2
|
|
27
|
-
];
|
|
28
|
-
const selectedValues = ref([
|
|
29
|
-
null,
|
|
30
|
-
null,
|
|
31
|
-
null
|
|
32
|
-
]);
|
|
33
|
-
const getLevelData = (level) => {
|
|
34
|
-
if (level === 0) return props.data;
|
|
35
|
-
if (!selectedValues.value[level - 1]) return [];
|
|
36
|
-
return getLevelData(level - 1).find((x) => x.value === selectedValues.value[level - 1])?.children || [];
|
|
37
|
-
};
|
|
38
|
-
const levelOptions = computed(() => levels.map((level) => getLevelData(level).map((item) => ({
|
|
39
|
-
label: item.label,
|
|
40
|
-
value: item.value
|
|
41
|
-
}))));
|
|
42
|
-
const handleChange = (index) => {
|
|
43
|
-
selectedValues.value.splice(index + 1, levels.length - index - 1, ...Array(levels.length - index - 1).fill(null));
|
|
44
|
-
emitValue();
|
|
45
|
-
};
|
|
46
|
-
const getSelectedItem = (index) => {
|
|
47
|
-
const value = selectedValues.value[index];
|
|
48
|
-
if (!value) return null;
|
|
49
|
-
const item = getLevelData(index).find((i) => i.value === value);
|
|
50
|
-
return item ? {
|
|
51
|
-
label: item.label,
|
|
52
|
-
value: item.value
|
|
53
|
-
} : null;
|
|
54
|
-
};
|
|
55
|
-
const emitValue = () => {
|
|
56
|
-
const result = {
|
|
57
|
-
primary: getSelectedItem(0),
|
|
58
|
-
secondary: getSelectedItem(1),
|
|
59
|
-
tertiary: getSelectedItem(2)
|
|
60
|
-
};
|
|
61
|
-
emit("update:modelValue", result);
|
|
62
|
-
emit("change", result);
|
|
63
|
-
};
|
|
64
|
-
watch(() => props.modelValue, (val) => {
|
|
65
|
-
selectedValues.value = [
|
|
66
|
-
val?.primary?.value ?? null,
|
|
67
|
-
val?.secondary?.value ?? null,
|
|
68
|
-
val?.tertiary?.value ?? null
|
|
69
|
-
];
|
|
70
|
-
}, {
|
|
71
|
-
immediate: true,
|
|
72
|
-
deep: true
|
|
73
|
-
});
|
|
74
|
-
return (_ctx, _cache) => {
|
|
75
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [(openBlock(), createElementBlock(Fragment, null, renderList(levels, (level, index) => {
|
|
76
|
-
return createVNode(unref(NSelect), {
|
|
77
|
-
key: index,
|
|
78
|
-
value: selectedValues.value[index],
|
|
79
|
-
"onUpdate:value": [($event) => selectedValues.value[index] = $event, ($event) => handleChange(index)],
|
|
80
|
-
options: levelOptions.value[index],
|
|
81
|
-
clearable: "",
|
|
82
|
-
placeholder: _ctx.placeholders[index],
|
|
83
|
-
disabled: index > 0 && !selectedValues.value[index - 1],
|
|
84
|
-
class: "n-select-item"
|
|
85
|
-
}, null, 8, [
|
|
86
|
-
"value",
|
|
87
|
-
"onUpdate:value",
|
|
88
|
-
"options",
|
|
89
|
-
"placeholder",
|
|
90
|
-
"disabled"
|
|
91
|
-
]);
|
|
92
|
-
}), 64))]);
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/components/C_Cascade/index.vue
|
|
99
|
-
var C_Cascade_default = /* @__PURE__ */ export_helper_default(index_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e3904f11"]]);
|
|
100
|
-
|
|
101
|
-
//#endregion
|
|
102
|
-
export { C_Cascade_default as t };
|
|
1
|
+
import{t as e}from"./export-helper.js";import{NSelect as t}from"naive-ui";import{Fragment as n,computed as r,createElementBlock as i,createVNode as a,defineComponent as o,openBlock as s,ref as c,renderList as l,unref as u,watch as d}from"vue";const f={class:`n-cascade-selector`};var p=e(o({name:`C_Cascade`,__name:`index`,props:{data:{},placeholders:{default:()=>[`请选择`,`请选择`,`请选择`]},modelValue:{}},emits:[`update:modelValue`,`change`],setup(e,{emit:o}){let p=e,m=o,h=[0,1,2],g=c([null,null,null]),_=e=>e===0?p.data:g.value[e-1]&&_(e-1).find(t=>t.value===g.value[e-1])?.children||[],v=r(()=>h.map(e=>_(e).map(e=>({label:e.label,value:e.value})))),y=e=>{g.value.splice(e+1,h.length-e-1,...Array(h.length-e-1).fill(null)),x()},b=e=>{let t=g.value[e];if(!t)return null;let n=_(e).find(e=>e.value===t);return n?{label:n.label,value:n.value}:null},x=()=>{let e={primary:b(0),secondary:b(1),tertiary:b(2)};m(`update:modelValue`,e),m(`change`,e)};return d(()=>p.modelValue,e=>{g.value=[e?.primary?.value??null,e?.secondary?.value??null,e?.tertiary?.value??null]},{immediate:!0,deep:!0}),(e,r)=>(s(),i(`div`,f,[(s(),i(n,null,l(h,(n,r)=>a(u(t),{key:r,value:g.value[r],"onUpdate:value":[e=>g.value[r]=e,e=>y(r)],options:v.value[r],clearable:``,placeholder:e.placeholders[r],disabled:r>0&&!g.value[r-1],class:`n-select-item`},null,8,[`value`,`onUpdate:value`,`options`,`placeholder`,`disabled`])),64))]))}}),[[`__scopeId`,`data-v-e3904f11`]]);export{p as t};
|
|
103
2
|
//# sourceMappingURL=C_Cascade2.js.map
|