fast-vue-multi-pages 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/FastVueMultiTool.d.ts +5 -0
- package/dist/cjs/FastVueMultiTool.js +5 -0
- package/dist/cjs/other/FastVueMultiFile.d.ts +7 -0
- package/dist/cjs/other/FastVueMultiFile.js +40 -0
- package/dist/esm/FastVueMultiTool.d.ts +5 -0
- package/dist/esm/FastVueMultiTool.js +5 -1
- package/dist/esm/other/FastVueMultiFile.d.ts +7 -0
- package/dist/esm/other/FastVueMultiFile.js +45 -0
- package/package.json +2 -2
- package/vue/FastVueMultiPages.js +2 -1
@@ -9,6 +9,7 @@ import { FastVueMultiBoolean } from "./other/FastVueMultiBoolean";
|
|
9
9
|
import { FastVueMultiFunction } from "./other/FastVueMultiFunction";
|
10
10
|
import { FastVueMultiElement } from "./other/FastVueMultiElement";
|
11
11
|
import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
|
12
|
+
import { FastVueMultiFile } from "./other/FastVueMultiFile";
|
12
13
|
/**
|
13
14
|
* FastBaseApp 手机APP功能工具类
|
14
15
|
*/
|
@@ -61,4 +62,8 @@ export declare class FastVueMultiTool {
|
|
61
62
|
* window对象相关操作
|
62
63
|
*/
|
63
64
|
static Window: typeof FastVueMultiWindow;
|
65
|
+
/**
|
66
|
+
* 文件选择器
|
67
|
+
*/
|
68
|
+
static File: typeof FastVueMultiFile;
|
64
69
|
}
|
@@ -13,6 +13,7 @@ const FastVueMultiBoolean_1 = require("./other/FastVueMultiBoolean");
|
|
13
13
|
const FastVueMultiFunction_1 = require("./other/FastVueMultiFunction");
|
14
14
|
const FastVueMultiElement_1 = require("./other/FastVueMultiElement");
|
15
15
|
const FastVueMultiWindow_1 = require("./other/FastVueMultiWindow");
|
16
|
+
const FastVueMultiFile_1 = require("./other/FastVueMultiFile");
|
16
17
|
/**
|
17
18
|
* FastBaseApp 手机APP功能工具类
|
18
19
|
*/
|
@@ -65,5 +66,9 @@ class FastVueMultiTool {
|
|
65
66
|
* window对象相关操作
|
66
67
|
*/
|
67
68
|
static Window = FastVueMultiWindow_1.FastVueMultiWindow;
|
69
|
+
/**
|
70
|
+
* 文件选择器
|
71
|
+
*/
|
72
|
+
static File = FastVueMultiFile_1.FastVueMultiFile;
|
68
73
|
}
|
69
74
|
exports.FastVueMultiTool = FastVueMultiTool;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FastVueMultiFile = void 0;
|
4
|
+
class FastVueMultiFile {
|
5
|
+
/**
|
6
|
+
* 弹出上传文件的选择框
|
7
|
+
* @param multi
|
8
|
+
*/
|
9
|
+
static showUploadImage(multi) {
|
10
|
+
return new Promise((resolve, reject) => {
|
11
|
+
let inputElement = document.createElement('input');
|
12
|
+
let event = new MouseEvent('click');
|
13
|
+
inputElement.type = "file";
|
14
|
+
inputElement.accept = "image/*";
|
15
|
+
if (multi) {
|
16
|
+
inputElement.multiple = true;
|
17
|
+
}
|
18
|
+
inputElement.onchange = function (selectEvent) {
|
19
|
+
if (selectEvent.target) {
|
20
|
+
let target = selectEvent.target;
|
21
|
+
let base64Array = [];
|
22
|
+
for (let i = 0; i < target.files.length; i++) {
|
23
|
+
const file = target.files.item(i);
|
24
|
+
const fileReader = new FileReader();
|
25
|
+
fileReader.onload = (readEvent) => {
|
26
|
+
let base64 = readEvent.target.result;
|
27
|
+
base64Array.push(base64);
|
28
|
+
if (base64Array.length === target.files.length) {
|
29
|
+
resolve(base64Array);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
fileReader.readAsDataURL(file);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
};
|
36
|
+
inputElement.dispatchEvent(event);
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.FastVueMultiFile = FastVueMultiFile;
|
@@ -9,6 +9,7 @@ import { FastVueMultiBoolean } from "./other/FastVueMultiBoolean";
|
|
9
9
|
import { FastVueMultiFunction } from "./other/FastVueMultiFunction";
|
10
10
|
import { FastVueMultiElement } from "./other/FastVueMultiElement";
|
11
11
|
import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
|
12
|
+
import { FastVueMultiFile } from "./other/FastVueMultiFile";
|
12
13
|
/**
|
13
14
|
* FastBaseApp 手机APP功能工具类
|
14
15
|
*/
|
@@ -61,4 +62,8 @@ export declare class FastVueMultiTool {
|
|
61
62
|
* window对象相关操作
|
62
63
|
*/
|
63
64
|
static Window: typeof FastVueMultiWindow;
|
65
|
+
/**
|
66
|
+
* 文件选择器
|
67
|
+
*/
|
68
|
+
static File: typeof FastVueMultiFile;
|
64
69
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1) {
|
1
|
+
define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow", "./other/FastVueMultiFile"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1, FastVueMultiFile_1) {
|
2
2
|
"use strict";
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.FastVueMultiTool = void 0;
|
@@ -57,6 +57,10 @@ define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./o
|
|
57
57
|
* window对象相关操作
|
58
58
|
*/
|
59
59
|
FastVueMultiTool.Window = FastVueMultiWindow_1.FastVueMultiWindow;
|
60
|
+
/**
|
61
|
+
* 文件选择器
|
62
|
+
*/
|
63
|
+
FastVueMultiTool.File = FastVueMultiFile_1.FastVueMultiFile;
|
60
64
|
return FastVueMultiTool;
|
61
65
|
}());
|
62
66
|
exports.FastVueMultiTool = FastVueMultiTool;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.FastVueMultiFile = void 0;
|
5
|
+
var FastVueMultiFile = /** @class */ (function () {
|
6
|
+
function FastVueMultiFile() {
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* 弹出上传文件的选择框
|
10
|
+
* @param multi
|
11
|
+
*/
|
12
|
+
FastVueMultiFile.showUploadImage = function (multi) {
|
13
|
+
return new Promise(function (resolve, reject) {
|
14
|
+
var inputElement = document.createElement('input');
|
15
|
+
var event = new MouseEvent('click');
|
16
|
+
inputElement.type = "file";
|
17
|
+
inputElement.accept = "image/*";
|
18
|
+
if (multi) {
|
19
|
+
inputElement.multiple = true;
|
20
|
+
}
|
21
|
+
inputElement.onchange = function (selectEvent) {
|
22
|
+
if (selectEvent.target) {
|
23
|
+
var target_1 = selectEvent.target;
|
24
|
+
var base64Array_1 = [];
|
25
|
+
for (var i = 0; i < target_1.files.length; i++) {
|
26
|
+
var file = target_1.files.item(i);
|
27
|
+
var fileReader = new FileReader();
|
28
|
+
fileReader.onload = function (readEvent) {
|
29
|
+
var base64 = readEvent.target.result;
|
30
|
+
base64Array_1.push(base64);
|
31
|
+
if (base64Array_1.length === target_1.files.length) {
|
32
|
+
resolve(base64Array_1);
|
33
|
+
}
|
34
|
+
};
|
35
|
+
fileReader.readAsDataURL(file);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
inputElement.dispatchEvent(event);
|
40
|
+
});
|
41
|
+
};
|
42
|
+
return FastVueMultiFile;
|
43
|
+
}());
|
44
|
+
exports.FastVueMultiFile = FastVueMultiFile;
|
45
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fast-vue-multi-pages",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5",
|
4
4
|
"author": "janesen",
|
5
5
|
"description": "快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html",
|
6
6
|
"main": "./dist/cjs/index.js",
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"tsc": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && tsc -p ./src/vue/tsconfig-cjs.json && tsc -p ./src/loader/tsconfig-cjs.json",
|
10
10
|
"login": "npm login",
|
11
11
|
"buildLocal": "npm run tsc",
|
12
|
-
"push-
|
12
|
+
"push-to-npm": "npm run buildLocal && npm publish"
|
13
13
|
},
|
14
14
|
"keywords": [
|
15
15
|
"vue",
|
package/vue/FastVueMultiPages.js
CHANGED
@@ -42,7 +42,8 @@ class FastVueMultiPages {
|
|
42
42
|
if (options.globalConfig) {
|
43
43
|
for (let globalConfigKey in options.globalConfig) {
|
44
44
|
// @ts-ignore
|
45
|
-
|
45
|
+
let value = options.globalConfig[globalConfigKey];
|
46
|
+
this.setGlobalConfig(globalConfigKey, value);
|
46
47
|
}
|
47
48
|
}
|
48
49
|
const defineValue = {
|