From 851412078441c8fd1faa70aa0916d2764430a881 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 20 Mar 2017 21:50:03 +0800 Subject: [PATCH] add --- Gruntfile.js | 2 +- demo/js/center.js | 47 +++++++++++++++++++++++++++++++++++++++++++++-- src/core/ob.js | 2 +- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 231de793cb..d20b063de7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -61,7 +61,7 @@ module.exports = function (grunt) { }, demoJs: { - src: ['demo/version.js', 'demo/**/*.js'], + src: ['demo/version.js', 'demo/app.js', 'demo/js/**/*.js'], dest: 'demo/dist/demo.js' }, demoCss: { diff --git a/demo/js/center.js b/demo/js/center.js index c3051dcf63..a17b0ed410 100644 --- a/demo/js/center.js +++ b/demo/js/center.js @@ -2,11 +2,54 @@ Demo.Center = BI.inherit(BI.Widget, { props: { baseCls: "demo-center" }, - beforeCreate: function(){ + beforeCreate: function () { console.log("beforeCreate"); }, render: function () { - console.log("render"); + return { + type: "bi.vertical", + hgap: 50, + vgap: 20, + items: [{ + type: "bi.label", + text: "栅格布局", + height: 50 + }, { + type: "bi.lattice", + columnSize: [0.1, 0.1, 0.3, 0.4, 0.1], + items: [{ + type: "bi.label", + height: 30, + text: "Left-1", + cls: "layout-bg1 lattice-item", + hgap: 20 + }, { + type: "bi.label", + height: 30, + text: "Left-2", + cls: "layout-bg2 lattice-item", + hgap: 20 + }, { + type: "bi.label", + height: 30, + text: "Left-3", + cls: "layout-bg3 lattice-item", + hgap: 20 + }, { + type: "bi.label", + height: 30, + text: "Left-4", + cls: "layout-bg4 lattice-item", + hgap: 20 + }, { + type: "bi.label", + height: 30, + text: "Left-5", + cls: "layout-bg5 lattice-item", + hgap: 20 + }] + }] + } }, created: function () { console.log("created"); diff --git a/src/core/ob.js b/src/core/ob.js index 700007636c..8f1d4a8851 100644 --- a/src/core/ob.js +++ b/src/core/ob.js @@ -6,6 +6,7 @@ BI.OB = function (config) { this.options = $.extend(this._defaultConfig(config), config); this._init(); + this._initRef(); }; $.extend(BI.OB.prototype, { props: {}, @@ -21,7 +22,6 @@ $.extend(BI.OB.prototype, { _init: function () { this._initListeners(); - this._initRef(); this.init(); },