fast-vue-multi-pages 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/other/FastVueMultiDate.js +1 -1
- package/dist/cjs/other/FastVueMultiFile.d.ts +3 -3
- package/dist/cjs/other/FastVueMultiFile.js +5 -18
- package/dist/esm/other/FastVueMultiDate.js +1 -1
- package/dist/esm/other/FastVueMultiFile.d.ts +3 -3
- package/dist/esm/other/FastVueMultiFile.js +15 -19
- package/package.json +3 -2
- package/vue/FastBuildOption.d.ts +6 -0
- package/vue/FastBuildOption.js +6 -0
- package/vue/FastVueMultiPages.js +6 -2
@@ -6,13 +6,13 @@ export declare class FastVueMultiFile {
|
|
6
6
|
static showUploadImage(multi: boolean): Promise<any>;
|
7
7
|
/**
|
8
8
|
* 将base64转为file对象
|
9
|
-
* @param
|
9
|
+
* @param base64Content base64内容
|
10
10
|
* @param fileName 文件名
|
11
11
|
*/
|
12
|
-
static base64ToFile(
|
12
|
+
static base64ToFile(base64Content: string, fileName: string): Promise<File>;
|
13
13
|
/**
|
14
14
|
* 将file对象转为base64
|
15
15
|
* @param file
|
16
16
|
*/
|
17
|
-
static fileToBase64(file: File): Promise<
|
17
|
+
static fileToBase64(file: File): Promise<string>;
|
18
18
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FastVueMultiFile = void 0;
|
4
|
+
const file64_1 = require("file64");
|
4
5
|
class FastVueMultiFile {
|
5
6
|
/**
|
6
7
|
* 弹出上传文件的选择框
|
@@ -43,32 +44,18 @@ class FastVueMultiFile {
|
|
43
44
|
}
|
44
45
|
/**
|
45
46
|
* 将base64转为file对象
|
46
|
-
* @param
|
47
|
+
* @param base64Content base64内容
|
47
48
|
* @param fileName 文件名
|
48
49
|
*/
|
49
|
-
static base64ToFile(
|
50
|
-
|
51
|
-
while (n--) {
|
52
|
-
u8arr[n] = bstr.charCodeAt(n);
|
53
|
-
}
|
54
|
-
const blob = new Blob([u8arr], { type: mime });
|
55
|
-
blob.lastModifiedDate = new Date();
|
56
|
-
blob.name = fileName;
|
57
|
-
return blob;
|
50
|
+
static async base64ToFile(base64Content, fileName) {
|
51
|
+
return await (0, file64_1.base64ToFile)(base64Content, fileName);
|
58
52
|
}
|
59
53
|
/**
|
60
54
|
* 将file对象转为base64
|
61
55
|
* @param file
|
62
56
|
*/
|
63
57
|
static async fileToBase64(file) {
|
64
|
-
return
|
65
|
-
const fileReader = new FileReader();
|
66
|
-
fileReader.onload = function (readEvent) {
|
67
|
-
let base64 = readEvent.target.result;
|
68
|
-
resolved(base64);
|
69
|
-
};
|
70
|
-
fileReader.readAsDataURL(file);
|
71
|
-
});
|
58
|
+
return await (0, file64_1.fileToBase64)(file);
|
72
59
|
}
|
73
60
|
}
|
74
61
|
exports.FastVueMultiFile = FastVueMultiFile;
|
@@ -29,7 +29,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
|
|
29
29
|
if (lodash_1.default.isEmpty(pattern)) {
|
30
30
|
return source.toLocaleString();
|
31
31
|
}
|
32
|
-
if (
|
32
|
+
if (!source) {
|
33
33
|
return null;
|
34
34
|
}
|
35
35
|
return (0, moment_1.default)(source).format(pattern);
|
@@ -6,13 +6,13 @@ export declare class FastVueMultiFile {
|
|
6
6
|
static showUploadImage(multi: boolean): Promise<any>;
|
7
7
|
/**
|
8
8
|
* 将base64转为file对象
|
9
|
-
* @param
|
9
|
+
* @param base64Content base64内容
|
10
10
|
* @param fileName 文件名
|
11
11
|
*/
|
12
|
-
static base64ToFile(
|
12
|
+
static base64ToFile(base64Content: string, fileName: string): Promise<File>;
|
13
13
|
/**
|
14
14
|
* 将file对象转为base64
|
15
15
|
* @param file
|
16
16
|
*/
|
17
|
-
static fileToBase64(file: File): Promise<
|
17
|
+
static fileToBase64(file: File): Promise<string>;
|
18
18
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
|
1
|
+
define(["require", "exports", "tslib", "file64"], function (require, exports, tslib_1, file64_1) {
|
2
2
|
"use strict";
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.FastVueMultiFile = void 0;
|
@@ -53,18 +53,18 @@ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
|
|
53
53
|
};
|
54
54
|
/**
|
55
55
|
* 将base64转为file对象
|
56
|
-
* @param
|
56
|
+
* @param base64Content base64内容
|
57
57
|
* @param fileName 文件名
|
58
58
|
*/
|
59
|
-
FastVueMultiFile.base64ToFile = function (
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
FastVueMultiFile.base64ToFile = function (base64Content, fileName) {
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
61
|
+
return tslib_1.__generator(this, function (_a) {
|
62
|
+
switch (_a.label) {
|
63
|
+
case 0: return [4 /*yield*/, (0, file64_1.base64ToFile)(base64Content, fileName)];
|
64
|
+
case 1: return [2 /*return*/, _a.sent()];
|
65
|
+
}
|
66
|
+
});
|
67
|
+
});
|
68
68
|
};
|
69
69
|
/**
|
70
70
|
* 将file对象转为base64
|
@@ -73,14 +73,10 @@ define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
|
|
73
73
|
FastVueMultiFile.fileToBase64 = function (file) {
|
74
74
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
75
75
|
return tslib_1.__generator(this, function (_a) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
resolved(base64);
|
81
|
-
};
|
82
|
-
fileReader.readAsDataURL(file);
|
83
|
-
})];
|
76
|
+
switch (_a.label) {
|
77
|
+
case 0: return [4 /*yield*/, (0, file64_1.fileToBase64)(file)];
|
78
|
+
case 1: return [2 /*return*/, _a.sent()];
|
79
|
+
}
|
84
80
|
});
|
85
81
|
});
|
86
82
|
};
|
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.10",
|
4
4
|
"author": "janesen",
|
5
5
|
"description": "快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html",
|
6
6
|
"main": "./dist/cjs/index.js",
|
@@ -31,7 +31,8 @@
|
|
31
31
|
"@types/js-cookie": "^3.0.6",
|
32
32
|
"@types/lodash": "^4.17.6",
|
33
33
|
"copy-to-clipboard": "^3.3.3",
|
34
|
-
"ip": "^2.0.1"
|
34
|
+
"ip": "^2.0.1",
|
35
|
+
"file64": "^1.0.3"
|
35
36
|
},
|
36
37
|
"devDependencies": {
|
37
38
|
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
package/vue/FastBuildOption.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
/**
|
2
2
|
* 获取编译配置的选项配置,配置选项如下:
|
3
3
|
* <br/>
|
4
|
+
* {@link devServer } 本地运行服务器配置参考文档:https://webpack.js.org/configuration/dev-server/#devserver
|
5
|
+
* <br/>
|
4
6
|
* {@link projectTitle } 项目名称
|
5
7
|
* <br/>
|
6
8
|
* {@link projectPagesDir } 项目存储页面的目录地址 默认:src/pages
|
@@ -230,6 +232,10 @@ export declare class FastBuildOption {
|
|
230
232
|
* 编译级别的标签名,默认 build-level
|
231
233
|
*/
|
232
234
|
buildLevelTagName: string;
|
235
|
+
/**
|
236
|
+
* 本地运行服务器配置 https://webpack.js.org/configuration/dev-server/#devserver
|
237
|
+
*/
|
238
|
+
devServer: any;
|
233
239
|
/**
|
234
240
|
* 插入Webpack函数function (config){};
|
235
241
|
*/
|
package/vue/FastBuildOption.js
CHANGED
@@ -4,6 +4,8 @@ exports.FastBuildOption = void 0;
|
|
4
4
|
/**
|
5
5
|
* 获取编译配置的选项配置,配置选项如下:
|
6
6
|
* <br/>
|
7
|
+
* {@link devServer } 本地运行服务器配置参考文档:https://webpack.js.org/configuration/dev-server/#devserver
|
8
|
+
* <br/>
|
7
9
|
* {@link projectTitle } 项目名称
|
8
10
|
* <br/>
|
9
11
|
* {@link projectPagesDir } 项目存储页面的目录地址 默认:src/pages
|
@@ -235,6 +237,10 @@ class FastBuildOption {
|
|
235
237
|
* 编译级别的标签名,默认 build-level
|
236
238
|
*/
|
237
239
|
buildLevelTagName = "build-level";
|
240
|
+
/**
|
241
|
+
* 本地运行服务器配置 https://webpack.js.org/configuration/dev-server/#devserver
|
242
|
+
*/
|
243
|
+
devServer;
|
238
244
|
/**
|
239
245
|
* 插入Webpack函数function (config){};
|
240
246
|
*/
|
package/vue/FastVueMultiPages.js
CHANGED
@@ -76,7 +76,7 @@ class FastVueMultiPages {
|
|
76
76
|
this.removeFile(cacheDir);
|
77
77
|
}
|
78
78
|
const { defineConfig } = require('@vue/cli-service');
|
79
|
-
|
79
|
+
let newConfig = {
|
80
80
|
outputDir: options.projectOutDir,
|
81
81
|
assetsDir: options.projectAssetsDir,
|
82
82
|
productionSourceMap: false,
|
@@ -172,7 +172,11 @@ class FastVueMultiPages {
|
|
172
172
|
options.configureWebpack(config);
|
173
173
|
}
|
174
174
|
}
|
175
|
-
}
|
175
|
+
};
|
176
|
+
if (options.devServer) {
|
177
|
+
newConfig["devServer"] = options.devServer;
|
178
|
+
}
|
179
|
+
return defineConfig(newConfig);
|
176
180
|
}
|
177
181
|
/**
|
178
182
|
* 设置全局变量值
|