Browse Source

优化一下

es6
guy 4 years ago
parent
commit
8b468c4b48
  1. 36
      hooks.html
  2. 15
      webpack/attachments.js

36
hooks.html

@ -50,11 +50,10 @@
}); });
BI.model("demo.model", Model); BI.model("demo.model", Model);
function expandFunction () {
function expandFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -84,11 +83,9 @@
}; };
} }
function clearAllFunction () { function clearAllFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -118,11 +115,9 @@
}; };
} }
function undoFunction () { function undoFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -152,11 +147,9 @@
}; };
} }
function redoFunction () { function redoFunction (storeCreator) {
var button; var button;
var store = BI.useStore(function () { var store = BI.useStore(storeCreator);
return BI.Models.getModel("demo.model");
});
BI.onBeforeMount(function () { BI.onBeforeMount(function () {
}); });
@ -188,10 +181,13 @@
var Widget = BI.inherit(BI.Widget, { var Widget = BI.inherit(BI.Widget, {
setup: function () { setup: function () {
var expandComponent = expandFunction(); var storeCreator = function () {
var clearAllComponent = clearAllFunction(); return BI.Models.getModel("demo.model");
var undoComponent = undoFunction(); };
var redoComponent = redoFunction(); var expandComponent = expandFunction(storeCreator);
var clearAllComponent = clearAllFunction(storeCreator);
var undoComponent = undoFunction(storeCreator);
var redoComponent = redoFunction(storeCreator);
return function () { return function () {
return { return {
type: "bi.vertical", type: "bi.vertical",

15
webpack/attachments.js

@ -10,6 +10,9 @@ function sync(patterns) {
const fixJs = "./dist/fix/fix.js"; const fixJs = "./dist/fix/fix.js";
const fixIEJs = "./dist/fix/fix.ie.js"; const fixIEJs = "./dist/fix/fix.ie.js";
const fixCompact = "./dist/fix/fix.compact.js";
const fixIECompact = './dist/fix/fix.compact.ie.js';
const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/lodash.js"; const lodashJs = "src/core/lodash.js";
const basicAttachmentMap = { const basicAttachmentMap = {
@ -125,7 +128,7 @@ const bundle = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'], [fixCompact, workerCompact],
basicAttachmentMap.router, basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
@ -139,7 +142,7 @@ const bundleIE = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.ie.js'], [fixIECompact, workerCompact],
basicAttachmentMap.router, basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
@ -164,7 +167,7 @@ const fineui = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
basicAttachmentMap.router, basicAttachmentMap.router,
["./dist/fix/fix.compact.js"], [fixCompact, workerCompact],
basicAttachmentMap.ui, basicAttachmentMap.ui,
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -177,7 +180,7 @@ const fineuiIE = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
basicAttachmentMap.router, basicAttachmentMap.router,
["./dist/fix/fix.compact.ie.js"], [fixIECompact, workerCompact],
basicAttachmentMap.ui, basicAttachmentMap.ui,
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -220,7 +223,7 @@ const fineuiWithoutJqueryAndPolyfillJs = [].concat(
"!src/case/tree/ztree/**/*.js", "!src/case/tree/ztree/**/*.js",
]), ]),
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["dist/fix/fix.compact.js", "ui/js/**/*.js"]), sync([fixCompact, workerCompact, "ui/js/**/*.js"]),
basicAttachmentMap.ts, basicAttachmentMap.ts,
); );
@ -233,7 +236,7 @@ const demo = [].concat(
basicAttachmentMap.case, basicAttachmentMap.case,
basicAttachmentMap.widget, basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]), sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'], [fixCompact, workerCompact],
basicAttachmentMap.config, basicAttachmentMap.config,
basicAttachmentMap.ts, basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]), sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),

Loading…
Cancel
Save