@yoooloo42/joker 1.0.9 → 1.0.10

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/index.esm.js CHANGED
@@ -1,3 +1,30 @@
1
+ import { resolveComponent, createElementBlock, openBlock, createVNode, createCommentVNode, createBlock, withCtx, createTextVNode, createElementVNode, toDisplayString, normalizeStyle } from 'vue';
2
+
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithoutHoles(r) {
9
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
10
+ }
11
+ function _iterableToArray(r) {
12
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
13
+ }
14
+ function _nonIterableSpread() {
15
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16
+ }
17
+ function _toConsumableArray(r) {
18
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
19
+ }
20
+ function _unsupportedIterableToArray(r, a) {
21
+ if (r) {
22
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
23
+ var t = {}.toString.call(r).slice(8, -1);
24
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
25
+ }
26
+ }
27
+
1
28
  /*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2
29
  /* vim: set ts=2: */
3
30
  /*exported XLSX */
@@ -15860,46 +15887,1011 @@ var FileSaver$1 = /*@__PURE__*/getDefaultExportFromCjs(FileSaver_minExports);
15860
15887
  * @param {Array<string>} header - 表格的表头(中文名)
15861
15888
  * @param {Array<string>} keys - 对应表头的数据字段名(英文键名)
15862
15889
  * @param {string} filename - 导出的文件名
15863
- */
15864
- function jsonToExcel({
15865
- json,
15866
- header,
15867
- keys,
15868
- filename = 'excel-file',
15869
- }) {
15870
- // 1. 转换数据格式
15871
- const data = json.map(item => keys.map(key => item[key]));
15872
-
15873
- // 2. 将表头和数据组合
15874
- const aoa = [header, ...data];
15875
-
15876
- // 3. 创建工作簿和工作表
15877
- const ws = utils.aoa_to_sheet(aoa);
15878
- const wb = utils.book_new();
15879
- utils.book_append_sheet(wb, ws, 'Sheet1');
15880
-
15881
- // 4. 生成 Excel 文件
15882
- const wbout = writeSync(wb, {
15883
- bookType: 'xlsx',
15884
- bookSST: true,
15885
- type: 'array'
15886
- });
15887
-
15888
- // 5. 保存文件
15889
- try {
15890
- FileSaver$1.saveAs(
15891
- new Blob([wbout], { type: 'application/octet-stream' }),
15892
- `${filename}.xlsx`
15893
- );
15894
- } catch (e) {
15895
- if (typeof console !== 'undefined') console.log(e, wbout);
15896
- }
15897
- }
15898
- var FileSaver = {
15899
- jsonToExcel
15890
+ */
15891
+ function jsonToExcel(_ref) {
15892
+ var json = _ref.json,
15893
+ header = _ref.header,
15894
+ keys = _ref.keys,
15895
+ _ref$filename = _ref.filename,
15896
+ filename = _ref$filename === void 0 ? 'excel-file' : _ref$filename;
15897
+ // 1. 转换数据格式
15898
+ var data = json.map(function (item) {
15899
+ return keys.map(function (key) {
15900
+ return item[key];
15901
+ });
15902
+ });
15903
+
15904
+ // 2. 将表头和数据组合
15905
+ var aoa = [header].concat(_toConsumableArray(data));
15906
+
15907
+ // 3. 创建工作簿和工作表
15908
+ var ws = utils.aoa_to_sheet(aoa);
15909
+ var wb = utils.book_new();
15910
+ utils.book_append_sheet(wb, ws, 'Sheet1');
15911
+
15912
+ // 4. 生成 Excel 文件
15913
+ var wbout = writeSync(wb, {
15914
+ bookType: 'xlsx',
15915
+ bookSST: true,
15916
+ type: 'array'
15917
+ });
15918
+
15919
+ // 5. 保存文件
15920
+ try {
15921
+ FileSaver$1.saveAs(new Blob([wbout], {
15922
+ type: 'application/octet-stream'
15923
+ }), "".concat(filename, ".xlsx"));
15924
+ } catch (e) {
15925
+ if (typeof console !== 'undefined') console.log(e, wbout);
15926
+ }
15927
+ }
15928
+ var FileSaver = {
15929
+ jsonToExcel: jsonToExcel
15930
+ };
15931
+
15932
+ var ly0default = {
15933
+ myProps: {
15934
+ uploadUrl: '',
15935
+ tip: '',
15936
+ // 提示信息
15937
+ limit: 1,
15938
+ // 允许上传的文件个数
15939
+ size: 2048,
15940
+ // 允许上传的文件大小,单位:KB
15941
+ type: '',
15942
+ // 允许上传的文件类型 示例:"image/jpeg", "image/png", "image/webp", "text/plain"
15943
+ avatar: {
15944
+ // 头像
15945
+ width: "120px",
15946
+ height: "160px"
15947
+ }
15948
+ },
15949
+ carplate: {
15950
+ // 车牌识别
15951
+ width: "400px",
15952
+ height: "300px"
15953
+ }
15954
+ };
15955
+
15956
+ var script$5 = {
15957
+ props: ['myProps'], // 注释见default.js中的myProps
15958
+ data(){return {
15959
+ fileList: []
15960
+ }},
15961
+ computed: {
15962
+ myProps0(){
15963
+ return Object.assign(ly0default.myProps, this.myProps)
15964
+ },
15965
+ limit(){
15966
+ return this.myProps0.limit
15967
+ }
15968
+ },
15969
+ methods: {
15970
+ hdlBeforeUpload (file) {
15971
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
15972
+ let isFileSize = file.size / 1024 < this.myProps0.size;
15973
+
15974
+ if (!isFileType) {
15975
+ this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
15976
+ return false
15977
+ }
15978
+ if (!isFileSize) {
15979
+ this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
15980
+ return false
15981
+ }
15982
+
15983
+ this.$message('正在上传 ...');
15984
+ return true
15985
+ },
15986
+ // eslint-disable-next-line
15987
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
15988
+ },
15989
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
15990
+ // 重置文件列表
15991
+ this.fileList = fileList;
15992
+
15993
+ // 返回上传结果
15994
+ let fileList0 = [];
15995
+ fileList.forEach(i=>{
15996
+ fileList0.push({
15997
+ src: i.response.data.src
15998
+ });
15999
+ });
16000
+ this.$emit('getUploadResult', {
16001
+ fileList: fileList0
16002
+ });
16003
+ },
16004
+ hdlSuccess (response, file, fileList) { // 上传
16005
+ if (response.code === 0) {
16006
+ // 重置文件列表
16007
+ this.fileList = fileList;
16008
+
16009
+ // 返回上传结果
16010
+ let fileList0 = [];
16011
+ fileList.forEach(i=>{
16012
+ fileList0.push({
16013
+ src: i.response.data.src
16014
+ });
16015
+ });
16016
+ this.$emit('getUploadResult', {
16017
+ fileList: fileList0
16018
+ });
16019
+ this.$message({
16020
+ type: 'info',
16021
+ message: '上传成功'
16022
+ });
16023
+ } else {
16024
+ this.$message({
16025
+ type: 'info',
16026
+ message: '上传失败'
16027
+ });
16028
+ }
16029
+ },
16030
+ hdlDeleteAll () { // 删除全部已上传文件
16031
+ // 重置文件列表
16032
+ this.fileList = [];
16033
+
16034
+ // 返回上传结果
16035
+ this.$emit('getUploadResult', {
16036
+ fileList: []
16037
+ });
16038
+ }
16039
+ }
16040
+ };
16041
+
16042
+ const _hoisted_1$5 = { class: "el-upload__tip" };
16043
+ const _hoisted_2$5 = {
16044
+ key: 0,
16045
+ style: {"font-size":"xx-small"}
16046
+ };
16047
+
16048
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
16049
+ const _component_el_button = resolveComponent("el-button");
16050
+ const _component_el_upload = resolveComponent("el-upload");
16051
+
16052
+ return (openBlock(), createElementBlock("div", null, [
16053
+ createVNode(_component_el_upload, {
16054
+ action: $options.myProps0.uploadUrl,
16055
+ "file-list": $data.fileList,
16056
+ "list-type": "text",
16057
+ "before-upload": $options.hdlBeforeUpload,
16058
+ "on-preview": $options.hdlPreview,
16059
+ "on-remove": $options.hdlRemove,
16060
+ "on-success": $options.hdlSuccess,
16061
+ limit: $options.limit
16062
+ }, {
16063
+ tip: withCtx(() => [
16064
+ createElementVNode("span", _hoisted_1$5, " " + toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.limit + "个文件"), 1 /* TEXT */)
16065
+ ]),
16066
+ default: withCtx(() => [
16067
+ createVNode(_component_el_button, {
16068
+ size: "small",
16069
+ type: "primary"
16070
+ }, {
16071
+ default: withCtx(() => [...(_cache[0] || (_cache[0] = [
16072
+ createTextVNode("点击上传", -1 /* CACHED */)
16073
+ ]))]),
16074
+ _: 1 /* STABLE */
16075
+ })
16076
+ ]),
16077
+ _: 1 /* STABLE */
16078
+ }, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
16079
+ ($data.fileList.length>0)
16080
+ ? (openBlock(), createElementBlock("div", _hoisted_2$5, toDisplayString("已上传"+$data.fileList.length+"个文件"), 1 /* TEXT */))
16081
+ : createCommentVNode("v-if", true),
16082
+ ($data.fileList.length>0)
16083
+ ? (openBlock(), createBlock(_component_el_button, {
16084
+ key: 1,
16085
+ size: "small",
16086
+ style: {"margin-top":"10px"},
16087
+ onClick: $options.hdlDeleteAll
16088
+ }, {
16089
+ default: withCtx(() => [...(_cache[1] || (_cache[1] = [
16090
+ createTextVNode("删除全部已上传文件", -1 /* CACHED */)
16091
+ ]))]),
16092
+ _: 1 /* STABLE */
16093
+ }, 8 /* PROPS */, ["onClick"]))
16094
+ : createCommentVNode("v-if", true)
16095
+ ]))
16096
+ }
16097
+
16098
+ script$5.render = render$5;
16099
+ script$5.__file = "src/upload/Upload.vue";
16100
+
16101
+ var script$4 = {
16102
+ props: ['myProps'], // 注释见default.js中的myProps
16103
+ data(){return {
16104
+ fileList: []
16105
+ }},
16106
+ computed: {
16107
+ myProps0(){
16108
+ return Object.assign(ly0default.myProps, this.myProps)
16109
+ }
16110
+ },
16111
+ methods: {
16112
+ hdlStyleAvatarBox(){
16113
+ return "width:" + this.myProps0.avatar.width + "; " +
16114
+ "height:" + this.myProps0.avatar.height + "; " +
16115
+ "position: relative; " +
16116
+ "overflow: hidden; " +
16117
+ "cursor: pointer;"
16118
+ },
16119
+ hdlStyleAvatarImage(){
16120
+ return "display: block;" +
16121
+ "width:" + this.myProps0.avatar.width + "; " +
16122
+ "height:" + this.myProps0.avatar.height + ";"
16123
+ },
16124
+ hdlStyleAvatarIcon(){
16125
+ return "display: block; " +
16126
+ "width:" + this.myProps0.avatar.width + "; " +
16127
+ "height:" + this.myProps0.avatar.height + "; " +
16128
+ "line-height:" + this.myProps0.avatar.height + "; " +
16129
+ "font-size: 28px; " +
16130
+ "color: #8c939d; " +
16131
+ "text-align: center;"
16132
+ },
16133
+ hdlBeforeUpload (file) {
16134
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
16135
+ let isFileSize = file.size / 1024 < this.myProps0.size;
16136
+
16137
+ if (!isFileType) {
16138
+ this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
16139
+ return false
16140
+ }
16141
+ if (!isFileSize) {
16142
+ this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
16143
+ return false
16144
+ }
16145
+
16146
+ this.$message('正在上传 ...');
16147
+ return true
16148
+ },
16149
+ // eslint-disable-next-line
16150
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
16151
+ },
16152
+ // eslint-disable-next-line
16153
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
16154
+ // 重置文件列表
16155
+ // 因为只能上传1个图片,移除即清空
16156
+ this.fileList = [];
16157
+
16158
+ // 返回上传结果
16159
+ this.$emit('getUploadResult', {
16160
+ fileList: []
16161
+ });
16162
+ },
16163
+ // eslint-disable-next-line
16164
+ hdlSuccess (response, file, fileList) { // 上传
16165
+ if (response.code === 0) {
16166
+ // 重置文件列表
16167
+ // 因为只能上传1个图片,这里需要清空图片列表
16168
+ this.fileList = [];
16169
+ this.fileList.push(file);
16170
+
16171
+ // 返回上传结果
16172
+ this.$emit('getUploadResult', {
16173
+ fileList: [{
16174
+ src: response.data.src
16175
+ }]
16176
+ });
16177
+ this.$message({
16178
+ type: 'info',
16179
+ message: '上传成功'
16180
+ });
16181
+ } else {
16182
+ this.$message({
16183
+ type: 'info',
16184
+ message: '上传失败'
16185
+ });
16186
+ }
16187
+ },
16188
+ hdlDeleteAll () { // 删除全部已上传文件
16189
+ // 重置文件列表
16190
+ this.fileList = [];
16191
+
16192
+ // 返回上传结果
16193
+ this.$emit('getUploadResult', {
16194
+ fileList: []
16195
+ });
16196
+ }
16197
+ }
16198
+ };
16199
+
16200
+ const _hoisted_1$4 = ["src"];
16201
+ const _hoisted_2$4 = { key: 0 };
16202
+
16203
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
16204
+ const _component_Plus = resolveComponent("Plus");
16205
+ const _component_el_icon = resolveComponent("el-icon");
16206
+ const _component_el_upload = resolveComponent("el-upload");
16207
+ const _component_el_button = resolveComponent("el-button");
16208
+
16209
+ return (openBlock(), createElementBlock("div", null, [
16210
+ createVNode(_component_el_upload, {
16211
+ class: "avatar",
16212
+ style: normalizeStyle($options.hdlStyleAvatarBox()),
16213
+ action: $options.myProps0.uploadUrl,
16214
+ "file-list": $data.fileList,
16215
+ "show-file-list": false,
16216
+ "before-upload": $options.hdlBeforeUpload,
16217
+ "on-preview": $options.hdlPreview,
16218
+ "on-remove": $options.hdlRemove,
16219
+ "on-success": $options.hdlSuccess
16220
+ }, {
16221
+ default: withCtx(() => [
16222
+ ($data.fileList.length>0 && $data.fileList[0].response.data.src)
16223
+ ? (openBlock(), createElementBlock("img", {
16224
+ key: 0,
16225
+ src: $data.fileList[0].response.data.src,
16226
+ style: normalizeStyle($options.hdlStyleAvatarImage())
16227
+ }, null, 12 /* STYLE, PROPS */, _hoisted_1$4))
16228
+ : (openBlock(), createBlock(_component_el_icon, {
16229
+ key: 1,
16230
+ class: "avatar-uploader-icon",
16231
+ style: normalizeStyle($options.hdlStyleAvatarIcon())
16232
+ }, {
16233
+ default: withCtx(() => [
16234
+ createVNode(_component_Plus)
16235
+ ]),
16236
+ _: 1 /* STABLE */
16237
+ }, 8 /* PROPS */, ["style"]))
16238
+ ]),
16239
+ _: 1 /* STABLE */
16240
+ }, 8 /* PROPS */, ["style", "action", "file-list", "before-upload", "on-preview", "on-remove", "on-success"]),
16241
+ ($data.fileList.length>0 && $data.fileList[0].response.data.src)
16242
+ ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
16243
+ createVNode(_component_el_button, {
16244
+ size: "small",
16245
+ icon: "el-icon-delete",
16246
+ style: {"margin-top":"10px"},
16247
+ onClick: $options.hdlDeleteAll
16248
+ }, {
16249
+ default: withCtx(() => [...(_cache[0] || (_cache[0] = [
16250
+ createTextVNode("删除", -1 /* CACHED */)
16251
+ ]))]),
16252
+ _: 1 /* STABLE */
16253
+ }, 8 /* PROPS */, ["onClick"])
16254
+ ]))
16255
+ : createCommentVNode("v-if", true)
16256
+ ]))
16257
+ }
16258
+
16259
+ script$4.render = render$4;
16260
+ script$4.__scopeId = "data-v-0b647a60";
16261
+ script$4.__file = "src/upload/Upload-avatar.vue";
16262
+
16263
+ var script$3 = {
16264
+ props: ['myProps'],
16265
+ data(){return {
16266
+ fileList: []
16267
+ }},
16268
+ computed: {
16269
+ myProps0(){
16270
+ return Object.assign(ly0default.myProps, this.myProps)
16271
+ }
16272
+ },
16273
+ methods: {
16274
+ hdlStyleAvatarBox(){
16275
+ return "width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
16276
+ "height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
16277
+ "position: relative; " +
16278
+ "overflow: hidden; " +
16279
+ "cursor: pointer;"
16280
+ },
16281
+ hdlStyleAvatarImage(){
16282
+ return "display: block;" +
16283
+ "width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
16284
+ "height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + ";"
16285
+ },
16286
+ hdlStyleAvatarIcon(){
16287
+ return "display: block; " +
16288
+ "width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
16289
+ "height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
16290
+ "line-height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
16291
+ "font-size: 28px; " +
16292
+ "color: #8c939d; " +
16293
+ "text-align: center;"
16294
+ },
16295
+ hdlBeforeUpload (file) {
16296
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
16297
+ let isFileSize = file.size / 1024 < this.myProps0.size;
16298
+
16299
+ if (!isFileType) {
16300
+ this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
16301
+ return false
16302
+ }
16303
+ if (!isFileSize) {
16304
+ this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
16305
+ return false
16306
+ }
16307
+
16308
+ this.$message('正在上传 ...');
16309
+ return true
16310
+ },
16311
+ // eslint-disable-next-line
16312
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
16313
+ },
16314
+ // eslint-disable-next-line
16315
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
16316
+ // 重置文件列表
16317
+ // 因为只能上传1个图片,移除即清空
16318
+ this.fileList = [];
16319
+
16320
+ // 返回上传和检测结果
16321
+ this.$emit('getUploadResult', {
16322
+ fileList: []
16323
+ });
16324
+ },
16325
+ // eslint-disable-next-line
16326
+ hdlSuccess (response, file, fileList) { // 上传
16327
+ if (response.code === 0) {
16328
+ // 重置文件列表
16329
+ // 因为只能上传1个图片,这里需要清空图片列表
16330
+ this.fileList = [];
16331
+ this.fileList.push(file);
16332
+
16333
+ // 返回上传结果
16334
+ this.$emit('getUploadResult', {
16335
+ src: response.data.src,
16336
+ result: response.data.result
16337
+ });
16338
+ this.$message({
16339
+ type: 'info',
16340
+ message: '上传成功'
16341
+ });
16342
+ } else {
16343
+ this.$message({
16344
+ type: 'info',
16345
+ message: '上传失败'
16346
+ });
16347
+ }
16348
+ },
16349
+ hdlDeleteAll () { // 删除全部已上传文件
16350
+ // 重置文件列表
16351
+ this.fileList = [];
16352
+
16353
+ // 返回上传结果
16354
+ this.$emit('getUploadResult', {
16355
+ fileList: []
16356
+ });
16357
+ }
16358
+ }
16359
+ };
16360
+
16361
+ const _hoisted_1$3 = ["src"];
16362
+ const _hoisted_2$3 = { key: 0 };
16363
+
16364
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
16365
+ const _component_Plus = resolveComponent("Plus");
16366
+ const _component_el_icon = resolveComponent("el-icon");
16367
+ const _component_el_upload = resolveComponent("el-upload");
16368
+ const _component_el_button = resolveComponent("el-button");
16369
+
16370
+ return (openBlock(), createElementBlock("div", null, [
16371
+ createVNode(_component_el_upload, {
16372
+ class: "avatar",
16373
+ style: normalizeStyle($options.hdlStyleAvatarBox()),
16374
+ action: $options.myProps0.uploadUrl,
16375
+ "file-list": $data.fileList,
16376
+ "show-file-list": false,
16377
+ "before-upload": $options.hdlBeforeUpload,
16378
+ "on-preview": $options.hdlPreview,
16379
+ "on-remove": $options.hdlRemove,
16380
+ "on-success": $options.hdlSuccess
16381
+ }, {
16382
+ default: withCtx(() => [
16383
+ ($data.fileList.length>0 && $data.fileList[0].response.data.src)
16384
+ ? (openBlock(), createElementBlock("img", {
16385
+ key: 0,
16386
+ src: $data.fileList[0].response.data.src,
16387
+ style: normalizeStyle($options.hdlStyleAvatarImage())
16388
+ }, null, 12 /* STYLE, PROPS */, _hoisted_1$3))
16389
+ : (openBlock(), createBlock(_component_el_icon, {
16390
+ key: 1,
16391
+ class: "avatar-uploader-icon",
16392
+ style: normalizeStyle($options.hdlStyleAvatarIcon())
16393
+ }, {
16394
+ default: withCtx(() => [
16395
+ createVNode(_component_Plus)
16396
+ ]),
16397
+ _: 1 /* STABLE */
16398
+ }, 8 /* PROPS */, ["style"]))
16399
+ ]),
16400
+ _: 1 /* STABLE */
16401
+ }, 8 /* PROPS */, ["style", "action", "file-list", "before-upload", "on-preview", "on-remove", "on-success"]),
16402
+ ($data.fileList.length>0 && $data.fileList[0].src)
16403
+ ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
16404
+ createVNode(_component_el_button, {
16405
+ size: "small",
16406
+ icon: "el-icon-delete",
16407
+ style: {"margin-top":"10px"},
16408
+ onClick: $options.hdlDeleteAll
16409
+ }, {
16410
+ default: withCtx(() => [...(_cache[0] || (_cache[0] = [
16411
+ createTextVNode("删除", -1 /* CACHED */)
16412
+ ]))]),
16413
+ _: 1 /* STABLE */
16414
+ }, 8 /* PROPS */, ["onClick"])
16415
+ ]))
16416
+ : createCommentVNode("v-if", true)
16417
+ ]))
16418
+ }
16419
+
16420
+ script$3.render = render$3;
16421
+ script$3.__scopeId = "data-v-6fc32e0e";
16422
+ script$3.__file = "src/upload/Upload-carplate.vue";
16423
+
16424
+ var script$2 = {
16425
+ props: ['myProps'],
16426
+ data(){return {
16427
+ fileList: []
16428
+ }},
16429
+ computed: {
16430
+ myProps0(){
16431
+ return Object.assign(ly0default.myProps, this.myProps)
16432
+ }
16433
+ },
16434
+ methods: {
16435
+ hdlBeforeUpload (file) {
16436
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
16437
+ let isFileSize = file.size / 1024 < this.myProps0.size;
16438
+
16439
+ if (!isFileType) {
16440
+ this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
16441
+ return false
16442
+ }
16443
+ if (!isFileSize) {
16444
+ this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
16445
+ return false
16446
+ }
16447
+
16448
+ this.$message('正在上传 ...');
16449
+ return true
16450
+ },
16451
+ // eslint-disable-next-line
16452
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
16453
+ },
16454
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
16455
+ // 重置文件列表
16456
+ this.fileList = fileList;
16457
+
16458
+ // 返回上传结果
16459
+ let fileList0 = [];
16460
+ fileList.forEach(i=>{
16461
+ fileList0.push({
16462
+ src: i.response.data.src
16463
+ });
16464
+ });
16465
+ this.$emit('getUploadResult', {
16466
+ fileList: fileList0
16467
+ });
16468
+ },
16469
+ hdlSuccess (response, file, fileList) { // 上传
16470
+ if (response.code === 0) {
16471
+ // 重置文件列表
16472
+ this.fileList = fileList;
16473
+
16474
+ // 返回上传结果
16475
+ let fileList0 = [];
16476
+ fileList.forEach(i=>{
16477
+ fileList0.push({
16478
+ src: i.response.data.src
16479
+ });
16480
+ });
16481
+ this.$emit('getUploadResult', {
16482
+ fileList: fileList0
16483
+ });
16484
+ this.$message({
16485
+ type: 'info',
16486
+ message: '上传成功'
16487
+ });
16488
+ } else {
16489
+ this.$message({
16490
+ type: 'info',
16491
+ message: '上传失败'
16492
+ });
16493
+ }
16494
+ },
16495
+ hdlDeleteAll () { // 删除全部已上传文件
16496
+ // 重置文件列表
16497
+ this.fileList = [];
16498
+
16499
+ // 返回上传结果
16500
+ this.$emit('getUploadResult', {
16501
+ fileList: []
16502
+ });
16503
+ }
16504
+ }
16505
+ };
16506
+
16507
+ const _hoisted_1$2 = { class: "el-upload__tip" };
16508
+ const _hoisted_2$2 = {
16509
+ key: 0,
16510
+ style: {"font-size":"xx-small"}
16511
+ };
16512
+
16513
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
16514
+ const _component_Upload = resolveComponent("Upload");
16515
+ const _component_el_icon = resolveComponent("el-icon");
16516
+ const _component_el_upload = resolveComponent("el-upload");
16517
+ const _component_el_button = resolveComponent("el-button");
16518
+
16519
+ return (openBlock(), createElementBlock("div", null, [
16520
+ createVNode(_component_el_upload, {
16521
+ action: $options.myProps0.uploadUrl,
16522
+ "file-list": $data.fileList,
16523
+ "list-type": "text",
16524
+ "before-upload": $options.hdlBeforeUpload,
16525
+ "on-preview": $options.hdlPreview,
16526
+ "on-remove": $options.hdlRemove,
16527
+ "on-success": $options.hdlSuccess,
16528
+ limit: $options.myProps0.limit,
16529
+ drag: ""
16530
+ }, {
16531
+ tip: withCtx(() => [
16532
+ createElementVNode("div", _hoisted_1$2, " " + toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个文件"), 1 /* TEXT */)
16533
+ ]),
16534
+ default: withCtx(() => [
16535
+ createVNode(_component_el_icon, null, {
16536
+ default: withCtx(() => [
16537
+ createVNode(_component_Upload)
16538
+ ]),
16539
+ _: 1 /* STABLE */
16540
+ }),
16541
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "el-upload__text" }, [
16542
+ createTextVNode("将文件拖到此处,或"),
16543
+ createElementVNode("em", null, "点击上传")
16544
+ ], -1 /* CACHED */))
16545
+ ]),
16546
+ _: 1 /* STABLE */
16547
+ }, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
16548
+ ($data.fileList.length>0)
16549
+ ? (openBlock(), createElementBlock("div", _hoisted_2$2, toDisplayString("已上传"+$data.fileList.length+"个文件"), 1 /* TEXT */))
16550
+ : createCommentVNode("v-if", true),
16551
+ ($data.fileList.length>0)
16552
+ ? (openBlock(), createBlock(_component_el_button, {
16553
+ key: 1,
16554
+ size: "small",
16555
+ style: {"margin-top":"10px"},
16556
+ onClick: $options.hdlDeleteAll
16557
+ }, {
16558
+ default: withCtx(() => [...(_cache[1] || (_cache[1] = [
16559
+ createTextVNode("删除全部已上传文件", -1 /* CACHED */)
16560
+ ]))]),
16561
+ _: 1 /* STABLE */
16562
+ }, 8 /* PROPS */, ["onClick"]))
16563
+ : createCommentVNode("v-if", true)
16564
+ ]))
16565
+ }
16566
+
16567
+ script$2.render = render$2;
16568
+ script$2.__file = "src/upload/Upload-drag.vue";
16569
+
16570
+ var script$1 = {
16571
+ props: ['myProps'],
16572
+ data(){return {
16573
+ fileList: []
16574
+ }},
16575
+ computed: {
16576
+ myProps0(){
16577
+ return Object.assign(ly0default.myProps, this.myProps)
16578
+ }
16579
+ },
16580
+ methods: {
16581
+ hdlBeforeUpload (file) {
16582
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
16583
+ let isFileSize = file.size / 1024 < this.myProps0.size;
16584
+
16585
+ if (!isFileType) {
16586
+ this.$message.error('上传图片的格式只能是 ' + this.myProps0.type);
16587
+ return false
16588
+ }
16589
+ if (!isFileSize) {
16590
+ this.$message.error('上传图片的大小不能超过 ' + this.myProps0.size + ' KB');
16591
+ return false
16592
+ }
16593
+
16594
+ this.$message('正在上传 ...');
16595
+ return true
16596
+ },
16597
+ // eslint-disable-next-line
16598
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
16599
+ },
16600
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
16601
+ // 重置文件列表
16602
+ this.fileList = fileList;
16603
+
16604
+ // 返回上传结果
16605
+ let fileList0 = [];
16606
+ fileList.forEach(i=>{
16607
+ fileList0.push({
16608
+ src: i.response.data.src
16609
+ });
16610
+ });
16611
+ this.$emit('getUploadResult', {
16612
+ fileList: fileList0
16613
+ });
16614
+ },
16615
+ hdlSuccess (response, file, fileList) { // 上传
16616
+ if (response.code === 0) {
16617
+ // 重置文件列表
16618
+ this.fileList = fileList;
16619
+
16620
+ // 返回上传结果
16621
+ let fileList0 = [];
16622
+ fileList.forEach(i=>{
16623
+ fileList0.push({
16624
+ src: i.response.data.src
16625
+ });
16626
+ });
16627
+ this.$emit('getUploadResult', {
16628
+ fileList: fileList0
16629
+ });
16630
+ this.$message({
16631
+ type: 'info',
16632
+ message: '上传成功'
16633
+ });
16634
+ } else {
16635
+ this.$message({
16636
+ type: 'info',
16637
+ message: '上传失败'
16638
+ });
16639
+ }
16640
+ },
16641
+ hdlDeleteAll () { // 删除全部已上传图片
16642
+ // 重置文件列表
16643
+ this.fileList = [];
16644
+
16645
+ // 返回上传结果
16646
+ this.$emit('getUploadResult', {
16647
+ fileList: []
16648
+ });
16649
+ }
16650
+ }
16651
+ };
16652
+
16653
+ const _hoisted_1$1 = { class: "el-upload__tip" };
16654
+ const _hoisted_2$1 = {
16655
+ key: 0,
16656
+ style: {"font-size":"xx-small"}
16657
+ };
16658
+
16659
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
16660
+ const _component_el_button = resolveComponent("el-button");
16661
+ const _component_el_upload = resolveComponent("el-upload");
16662
+
16663
+ return (openBlock(), createElementBlock("div", null, [
16664
+ createVNode(_component_el_upload, {
16665
+ action: $options.myProps0.uploadUrl,
16666
+ "file-list": $data.fileList,
16667
+ "list-type": "picture",
16668
+ "before-upload": $options.hdlBeforeUpload,
16669
+ "on-preview": $options.hdlPreview,
16670
+ "on-remove": $options.hdlRemove,
16671
+ "on-success": $options.hdlSuccess,
16672
+ limit: $options.myProps0.limit
16673
+ }, {
16674
+ tip: withCtx(() => [
16675
+ createElementVNode("div", _hoisted_1$1, " " + toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个图片"), 1 /* TEXT */)
16676
+ ]),
16677
+ default: withCtx(() => [
16678
+ createVNode(_component_el_button, {
16679
+ size: "small",
16680
+ type: "primary"
16681
+ }, {
16682
+ default: withCtx(() => [...(_cache[0] || (_cache[0] = [
16683
+ createTextVNode("点击上传", -1 /* CACHED */)
16684
+ ]))]),
16685
+ _: 1 /* STABLE */
16686
+ })
16687
+ ]),
16688
+ _: 1 /* STABLE */
16689
+ }, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
16690
+ ($data.fileList.length>0)
16691
+ ? (openBlock(), createElementBlock("div", _hoisted_2$1, toDisplayString("已上传"+$data.fileList.length+"个图片"), 1 /* TEXT */))
16692
+ : createCommentVNode("v-if", true),
16693
+ ($data.fileList.length>0)
16694
+ ? (openBlock(), createBlock(_component_el_button, {
16695
+ key: 1,
16696
+ size: "small",
16697
+ style: {"margin-top":"10px"},
16698
+ onClick: $options.hdlDeleteAll
16699
+ }, {
16700
+ default: withCtx(() => [...(_cache[1] || (_cache[1] = [
16701
+ createTextVNode("删除全部已上传图片", -1 /* CACHED */)
16702
+ ]))]),
16703
+ _: 1 /* STABLE */
16704
+ }, 8 /* PROPS */, ["onClick"]))
16705
+ : createCommentVNode("v-if", true)
16706
+ ]))
16707
+ }
16708
+
16709
+ script$1.render = render$1;
16710
+ script$1.__file = "src/upload/Upload-picture.vue";
16711
+
16712
+ var script = {
16713
+ props: ['myProps'],
16714
+ data: function () {
16715
+ return {
16716
+ fileList: [],
16717
+ dialogImageUrl: '',
16718
+ dialogVisible: false
16719
+ }
16720
+ },
16721
+ computed: {
16722
+ myProps0(){
16723
+ return Object.assign(ly0default.myProps, this.myProps)
16724
+ }
16725
+ },
16726
+ methods: {
16727
+ hdlBeforeUpload (file) {
16728
+ let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
16729
+ let isFileSize = file.size / 1024 < this.myProps0.size;
16730
+
16731
+ if (!isFileType) {
16732
+ this.$message.error('上传图片的格式只能是 ' + this.myProps0.type);
16733
+ return false
16734
+ }
16735
+ if (!isFileSize) {
16736
+ this.$message.error('上传图片的大小不能超过 ' + this.myProps0.size + ' KB');
16737
+ return false
16738
+ }
16739
+
16740
+ this.$message('正在上传 ...');
16741
+ return true
16742
+ },
16743
+ hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
16744
+ this.dialogImageUrl = file.url;
16745
+ this.dialogVisible = true;
16746
+ },
16747
+ hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
16748
+ // 重置文件列表
16749
+ this.fileList = fileList;
16750
+
16751
+ // 返回上传结果
16752
+ let fileList0 = [];
16753
+ fileList.forEach(i=>{
16754
+ fileList0.push({
16755
+ src: i.response.data.src
16756
+ });
16757
+ });
16758
+ this.$emit('getUploadResult', {
16759
+ fileList: fileList0
16760
+ });
16761
+ },
16762
+ hdlSuccess (response, file, fileList) { // 上传
16763
+ if (response.code === 0) {
16764
+ // 重置文件列表
16765
+ this.fileList = fileList;
16766
+
16767
+ // 返回上传结果
16768
+ let fileList0 = [];
16769
+ fileList.forEach(i=>{
16770
+ fileList0.push({
16771
+ src: i.response.data.src
16772
+ });
16773
+ });
16774
+ this.$emit('getUploadResult', {
16775
+ fileList: fileList0
16776
+ });
16777
+ this.$message({
16778
+ type: 'info',
16779
+ message: '上传成功'
16780
+ });
16781
+ } else {
16782
+ this.$message({
16783
+ type: 'info',
16784
+ message: '上传失败'
16785
+ });
16786
+ }
16787
+ },
16788
+ hdlDeleteAll () { // 删除全部已上传图片
16789
+ // 重置文件列表
16790
+ this.fileList = [];
16791
+
16792
+ // 返回上传结果
16793
+ this.$emit('getUploadResult', {
16794
+ fileList: []
16795
+ });
16796
+ }
16797
+ }
16798
+ };
16799
+
16800
+ const _hoisted_1 = { class: "el-upload__tip" };
16801
+ const _hoisted_2 = ["src"];
16802
+ const _hoisted_3 = {
16803
+ key: 0,
16804
+ style: {"font-size":"xx-small"}
16805
+ };
16806
+
16807
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
16808
+ const _component_Plus = resolveComponent("Plus");
16809
+ const _component_el_icon = resolveComponent("el-icon");
16810
+ const _component_el_upload = resolveComponent("el-upload");
16811
+ const _component_el_dialog = resolveComponent("el-dialog");
16812
+ const _component_el_button = resolveComponent("el-button");
16813
+
16814
+ return (openBlock(), createElementBlock("div", null, [
16815
+ createVNode(_component_el_upload, {
16816
+ action: $options.myProps0.uploadUrl,
16817
+ "file-list": _ctx.fileList,
16818
+ "list-type": "picture-card",
16819
+ "before-upload": $options.hdlBeforeUpload,
16820
+ "on-preview": $options.hdlPreview,
16821
+ "on-remove": $options.hdlRemove,
16822
+ "on-success": $options.hdlSuccess,
16823
+ limit: $options.myProps0.limit
16824
+ }, {
16825
+ tip: withCtx(() => [
16826
+ createElementVNode("div", _hoisted_1, " " + toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个图片"), 1 /* TEXT */)
16827
+ ]),
16828
+ default: withCtx(() => [
16829
+ createVNode(_component_el_icon, null, {
16830
+ default: withCtx(() => [
16831
+ createVNode(_component_Plus)
16832
+ ]),
16833
+ _: 1 /* STABLE */
16834
+ })
16835
+ ]),
16836
+ _: 1 /* STABLE */
16837
+ }, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
16838
+ createVNode(_component_el_dialog, {
16839
+ modelValue: _ctx.dialogVisible,
16840
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((_ctx.dialogVisible) = $event))
16841
+ }, {
16842
+ default: withCtx(() => [
16843
+ createElementVNode("img", {
16844
+ width: "100%",
16845
+ src: _ctx.dialogImageUrl,
16846
+ alt: ""
16847
+ }, null, 8 /* PROPS */, _hoisted_2)
16848
+ ]),
16849
+ _: 1 /* STABLE */
16850
+ }, 8 /* PROPS */, ["modelValue"]),
16851
+ (_ctx.fileList.length>0)
16852
+ ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString("已上传"+_ctx.fileList.length+"个图片"), 1 /* TEXT */))
16853
+ : createCommentVNode("v-if", true),
16854
+ (_ctx.fileList.length>0)
16855
+ ? (openBlock(), createBlock(_component_el_button, {
16856
+ key: 1,
16857
+ size: "small",
16858
+ style: {"margin-top":"10px"},
16859
+ onClick: $options.hdlDeleteAll
16860
+ }, {
16861
+ default: withCtx(() => [...(_cache[1] || (_cache[1] = [
16862
+ createTextVNode("删除全部已上传图片", -1 /* CACHED */)
16863
+ ]))]),
16864
+ _: 1 /* STABLE */
16865
+ }, 8 /* PROPS */, ["onClick"]))
16866
+ : createCommentVNode("v-if", true)
16867
+ ]))
16868
+ }
16869
+
16870
+ script.render = render;
16871
+ script.__file = "src/upload/Upload-picture-card.vue";
16872
+
16873
+ var upload = {
16874
+ Upload: script$5,
16875
+ Upload_avatar: script$4,
16876
+ Upload_carplate: script$3,
16877
+ Upload_drag: script$2,
16878
+ Upload_picture: script$1,
16879
+ Upload_pictureCard: script
15900
16880
  };
15901
16881
 
15902
- var index = {FileSaver};
16882
+ var index = {
16883
+ install: function install(app, options) {
16884
+ // 全局注册组件
16885
+ app.component('ly0Upload', upload.Upload);
16886
+ app.component('ly0Upload_avatar', upload.Upload_avatar);
16887
+ app.component('ly0Upload_carplate', upload.Upload_carplate);
16888
+ app.component('ly0Upload_drag', upload.Upload_drag);
16889
+ app.component('ly0Upload_picture', upload.Upload_picture);
16890
+ app.component('ly0Upload_pictureCard', upload.Upload_pictureCard);
16891
+ },
16892
+ FileSaver: FileSaver,
16893
+ upload: upload
16894
+ };
15903
16895
 
15904
- export { FileSaver, index as default };
16896
+ export { FileSaver, index as default, upload };
15905
16897
  //# sourceMappingURL=index.esm.js.map