From 8b468c4b48e0cd8f8a2785b112dde6be820ed825 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 22 Nov 2020 01:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks.html | 36 ++++++++++++++++-------------------- webpack/attachments.js | 15 +++++++++------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/hooks.html b/hooks.html index 40d5ba6e6..4953dc389 100644 --- a/hooks.html +++ b/hooks.html @@ -50,11 +50,10 @@ }); BI.model("demo.model", Model); - function expandFunction () { + + function expandFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -84,11 +83,9 @@ }; } - function clearAllFunction () { + function clearAllFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -118,11 +115,9 @@ }; } - function undoFunction () { + function undoFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -152,11 +147,9 @@ }; } - function redoFunction () { + function redoFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -188,10 +181,13 @@ var Widget = BI.inherit(BI.Widget, { setup: function () { - var expandComponent = expandFunction(); - var clearAllComponent = clearAllFunction(); - var undoComponent = undoFunction(); - var redoComponent = redoFunction(); + var storeCreator = function () { + return BI.Models.getModel("demo.model"); + }; + var expandComponent = expandFunction(storeCreator); + var clearAllComponent = clearAllFunction(storeCreator); + var undoComponent = undoFunction(storeCreator); + var redoComponent = redoFunction(storeCreator); return function () { return { type: "bi.vertical", diff --git a/webpack/attachments.js b/webpack/attachments.js index 07cbb6897..fd6711f38 100644 --- a/webpack/attachments.js +++ b/webpack/attachments.js @@ -10,6 +10,9 @@ function sync(patterns) { const fixJs = "./dist/fix/fix.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 basicAttachmentMap = { @@ -125,7 +128,7 @@ const bundle = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.js'], + [fixCompact, workerCompact], basicAttachmentMap.router, sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), basicAttachmentMap.ts, @@ -139,7 +142,7 @@ const bundleIE = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.ie.js'], + [fixIECompact, workerCompact], basicAttachmentMap.router, sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), basicAttachmentMap.ts, @@ -164,7 +167,7 @@ const fineui = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, basicAttachmentMap.router, - ["./dist/fix/fix.compact.js"], + [fixCompact, workerCompact], basicAttachmentMap.ui, basicAttachmentMap.ts, ); @@ -177,7 +180,7 @@ const fineuiIE = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, basicAttachmentMap.router, - ["./dist/fix/fix.compact.ie.js"], + [fixIECompact, workerCompact], basicAttachmentMap.ui, basicAttachmentMap.ts, ); @@ -220,7 +223,7 @@ const fineuiWithoutJqueryAndPolyfillJs = [].concat( "!src/case/tree/ztree/**/*.js", ]), basicAttachmentMap.widget, - sync(["dist/fix/fix.compact.js", "ui/js/**/*.js"]), + sync([fixCompact, workerCompact, "ui/js/**/*.js"]), basicAttachmentMap.ts, ); @@ -233,7 +236,7 @@ const demo = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.js'], + [fixCompact, workerCompact], basicAttachmentMap.config, basicAttachmentMap.ts, sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),