From 15c19bdf901cf8fbe63f440f77f637448fc73e0c Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Tue, 13 Oct 2020 14:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20chore:=20upda?= =?UTF-8?q?te=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/fix-2.0/inject.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/demo/js/fix-2.0/inject.js b/demo/js/fix-2.0/inject.js index 3c7b27fcb..a5734635a 100644 --- a/demo/js/fix-2.0/inject.js +++ b/demo/js/fix-2.0/inject.js @@ -9,7 +9,17 @@ } }; }, - childContext: ["context"] + childContext: ["context"], + + actions: { + changeContext: function () { + this.model.context = { + two: { + key: "two.key" + } + }; + } + } }); BI.model("demo.model.inject.parent_store", ParentStore); @@ -24,8 +34,8 @@ actions: { changeContext: function () { this.model.context = { - two: { - key: "two.key" + one: { + key: "one.changed_key" } }; } @@ -56,9 +66,6 @@ } }; }, - mounted: function () { - - } }); BI.shortcut("demo.fix_inject_child", Child); @@ -70,11 +77,19 @@ render: function () { var self = this; return { - type: "bi.absolute", + type: "bi.vertical", items: [{ el: { type: "demo.fix_inject_child" } + }, { + el: { + type: "bi.button", + text: "点击修改parent state", + handler: function () { + self.store.changeContext(); + } + } }] }; },