1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2026-01-12 07:13:08 +08:00

支持部分组件懒加载,但未完成支持

This commit is contained in:
shangbin
2021-10-22 20:19:12 +08:00
parent 178900c662
commit bc30b01c5e
8 changed files with 188 additions and 63 deletions

View File

@@ -55,21 +55,12 @@
<script>
import { splitInit } from "../libs/split-init";
// 这个文件不可以进行懒加载,它会导致运行时不可点击的行为,具体原因未知
import { MainPanelProvider } from "../libs/main-panel";
import { initContainerForLine } from "@/utils/lineHelper";
const keymaster = require('keymaster');
import styleData from "../map/style.index.js";
import methodData from "../map/method.index.js";
import dataData from "../map/data.index.js";
import templateData from "../map/template.index.js";
window.templateSourceMap = templateData;
window.dataSourceMap = dataData;
window.methodSourceMap = methodData;
window.styleSourceMap = styleData;
export default {
name: "vcc",
props: ['initCodeEntity'],
@@ -114,8 +105,11 @@ export default {
},
beforeMount() { },
mounted() {
Promise.all([import("../map/load")])
.then(res => {
this.init();
});
splitInit();
this.init();
this.initShortcut();
},
beforeUpdate() { },

View File

@@ -11,10 +11,6 @@ import "./assets/nestable.css"
Vue.use(ElementUI);
Vue.use(AntdUI);
Vue.config.errorHandler = function (err, vm, info) {
console.error(err);
}
new Vue({
el: "#app",
render: (h) => h(APP),

12
src/map/load.js Normal file
View File

@@ -0,0 +1,12 @@
/**
* 加载外部代码资源
*/
import styleData from "../map/style.index.js";
import methodData from "../map/method.index.js";
import dataData from "../map/data.index.js";
import templateData from "../map/template.index.js";
window.templateSourceMap = templateData;
window.dataSourceMap = dataData;
window.methodSourceMap = methodData;
window.styleSourceMap = styleData;

17
src/script/distClear.js Normal file
View File

@@ -0,0 +1,17 @@
const glob = require("glob");
const file = require("fs");
glob(
"**/*.js",
{
cwd: "./dist/",
absolute: true,
ignore: ["**/*.min.*"],
},
function (er, files) {
console.info(`正在清理多余文件...`);
files.forEach((filePath) => {
file.rm(filePath, function (er) {});
});
}
);