fast-vue-multi-pages-vite 1.3.26 → 1.3.28
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.js +8 -0
- package/package.json +1 -1
- package/vite/index.d.ts +4 -0
- package/vite/index.js +9 -2
package/dist/index.js
CHANGED
|
@@ -46,13 +46,21 @@ var FastViteMultiConfig = class {
|
|
|
46
46
|
static toTruthUrl(path) {
|
|
47
47
|
let currUrl = window.location.href.split("#")[0].split("?")[0];
|
|
48
48
|
let pages = this.getConfig("pages");
|
|
49
|
+
let isWrap = false;
|
|
49
50
|
for (let pageKey in pages) {
|
|
50
51
|
let relativePath = pageKey + ".html";
|
|
52
|
+
let wrapRelativePath = pageKey + "_wrap.html";
|
|
51
53
|
if (currUrl.indexOf(relativePath) > 0) {
|
|
52
54
|
currUrl = currUrl.replace(relativePath, "");
|
|
53
55
|
break;
|
|
54
56
|
}
|
|
57
|
+
if (currUrl.indexOf(wrapRelativePath) > 0) {
|
|
58
|
+
currUrl = currUrl.replace(wrapRelativePath, "");
|
|
59
|
+
isWrap = true;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
55
62
|
}
|
|
63
|
+
if (isWrap) path = path.replace(".html", "_wrap.html");
|
|
56
64
|
return currUrl + path;
|
|
57
65
|
}
|
|
58
66
|
};
|
package/package.json
CHANGED
package/vite/index.d.ts
CHANGED
package/vite/index.js
CHANGED
|
@@ -228,6 +228,10 @@ var FastViteMultiPagesOption = class {
|
|
|
228
228
|
* iframe页面最小高度
|
|
229
229
|
*/
|
|
230
230
|
wrapMinHeight = -1;
|
|
231
|
+
/**
|
|
232
|
+
* 是否开启页面适配
|
|
233
|
+
*/
|
|
234
|
+
wrapSize = false;
|
|
231
235
|
};
|
|
232
236
|
|
|
233
237
|
//#endregion
|
|
@@ -393,7 +397,8 @@ createApp(child).mount("${options.mountSelector}");`;
|
|
|
393
397
|
vue: path$1.posix.join(subPageDirRelativePath, vueFileName),
|
|
394
398
|
page_dir: subPageDirRelativePath,
|
|
395
399
|
build: true,
|
|
396
|
-
build_type: "multi"
|
|
400
|
+
build_type: "multi",
|
|
401
|
+
wrap_size: false
|
|
397
402
|
};
|
|
398
403
|
if (options.projectPagesRoot === pageDirName) {
|
|
399
404
|
pagesMap[pageKey]["filename"] = fileName + ".html";
|
|
@@ -402,6 +407,7 @@ createApp(child).mount("${options.mountSelector}");`;
|
|
|
402
407
|
pagesMap[pageKey]["filename"] = pageDirName + "/" + fileName + ".html";
|
|
403
408
|
pagesMap[pageKey]["readme"] = "多页面配置信息,编译后访问地址格式为:http://[ip]:[port]/" + pageDirName + "/" + fileName + ".html";
|
|
404
409
|
}
|
|
410
|
+
if (options.wrapSize) pagesMap[pageKey]["wrap_size"] = true;
|
|
405
411
|
let configFilePath = path$1.posix.join(subPageDirPath, options.pageConfigFileName);
|
|
406
412
|
if (fs$1.existsSync(configFilePath)) {
|
|
407
413
|
let configContent = fs$1.readFileSync(configFilePath);
|
|
@@ -1083,7 +1089,8 @@ var FastViteMultiTool = class FastViteMultiTool {
|
|
|
1083
1089
|
let min_width = pageConfig.wrap_min_width || options.wrapMinWidth;
|
|
1084
1090
|
let min_height = pageConfig.wrap_min_height || options.wrapMinHeight;
|
|
1085
1091
|
if (min_width > 0 && min_height > 0) {
|
|
1086
|
-
let
|
|
1092
|
+
let contentPath = pageConfig.filename.substring(pageConfig.filename.lastIndexOf("/") + 1);
|
|
1093
|
+
let iframeHtml = FastViteTemplate.getWrapSizeHtml(pageConfig.title, contentPath, min_width, min_height);
|
|
1087
1094
|
fs$1.writeFileSync(file_wrap_size_path, iframeHtml, {});
|
|
1088
1095
|
rollupOptions.input[pagesKey + "_wrap"] = file_wrap_size_path;
|
|
1089
1096
|
FastViteMultiTool._ghostFile.push(file_wrap_size_path);
|