From 45d9c7b907f52f1931f46ef53ca1bbf370949bcf Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 21 Aug 2021 01:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/app.js | 16 ++++++++-------- dist/router.js | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/demo/app.js b/demo/app.js index fea6d0872..f38691b86 100644 --- a/demo/app.js +++ b/demo/app.js @@ -9,8 +9,8 @@ BI.$(function () { }); var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG); - var routes = [{ - path: '/', + var routes = [{ + path: '/', component: function(){ return Promise.resolve({ type: "demo.face" @@ -20,13 +20,13 @@ BI.$(function () { BI.Tree.traversal(tree, function (index, node) { if (!node.children || BI.isEmptyArray(node.children)) { - routes.push({ - path: '/' + node.text, + routes.push({ + path: '/' + node.text, component: function(){ return Promise.resolve({ type: node.value }) - } + } }); } }); @@ -38,7 +38,7 @@ BI.$(function () { BI.createWidget({ type: "bi.router", ref: function (_ref) { - BI.router = _ref._router; + BI.$router = _ref.$router; }, element: "#wrapper", routes: routes, @@ -50,6 +50,6 @@ BI.$(function () { ref = _ref; } } - } + } }); -}); \ No newline at end of file +}); diff --git a/dist/router.js b/dist/router.js index 176350913..27c1b4a38 100644 --- a/dist/router.js +++ b/dist/router.js @@ -3125,13 +3125,13 @@ var $router, cbs = []; var RouterWidget = BI.inherit(BI.Widget, { init: function () { - this._router = $router = new VueRouter({ + this.$router = BI.Router.$router = $router = new VueRouter({ routes: this.options.routes }); - this._router.afterEach(function () { + this.$router.afterEach(function () { cbs.forEach(function (cb) {cb();}); }); - this._router.init(this); + this.$router.init(this); } }); BI.shortcut("bi.router", RouterWidget);