Browse Source

feat: 修改bi.a

es6
Joker.Wang-王顺 2 years ago
parent
commit
b6f291ae78
  1. 99
      demo/js/core/abstract/demo.button_group.js
  2. 27
      src/base/single/a/a.js

99
demo/js/core/abstract/demo.button_group.js

@ -7,54 +7,63 @@ Demo.Func = BI.inherit(BI.Widget, {
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.button_group", type: "bi.a",
ref: function (_ref) {
ref = _ref;
},
chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE,
layouts: [{
type: "bi.vertical",
items: [{
type: "bi.vtape",
height: 200
}]
}],
items: [{
el: { el: {
type: "bi.label", type: "bi.label",
text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)" text: "这就是一个百度超链"
}, },
height: 150 href: "https://www.baidu.com"
}, { }],
el: { // type: "bi.vertical",
type: "bi.button", // items: [{
text: "1" // type: "bi.button_group",
} // ref: function (_ref) {
}] // ref = _ref;
}, { // },
type: "bi.button", // chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE,
text: "populate", // layouts: [{
handler: function () { // type: "bi.vertical",
ref.populate([{ // items: [{
el: { // type: "bi.vtape",
type: "bi.label", // height: 200
text: "1" // }]
}, // }],
height: 50 // items: [{
}, { // el: {
el: { // type: "bi.label",
type: "bi.button", // text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)"
text: "2" // },
}, // height: 150
height: 50 // }, {
}, { // el: {
el: { // type: "bi.button",
type: "bi.label", // text: "1"
text: "3" // }
} // }]
}]); // }, {
} // type: "bi.button",
}] // text: "populate",
// handler: function () {
// ref.populate([{
// el: {
// type: "bi.label",
// text: "1"
// },
// height: 50
// }, {
// el: {
// type: "bi.button",
// text: "2"
// },
// height: 50
// }, {
// el: {
// type: "bi.label",
// text: "3"
// }
// }]);
// }
// }]
}; };
} }

27
src/base/single/a/a.js

@ -6,10 +6,16 @@
* @extends BI.Text * @extends BI.Text
* @abstract * @abstract
*/ */
BI.A = BI.inherit(BI.Text, { import { shortcut } from "../../../core/decorator";
_defaultConfig: function () { @shortcut()
var conf = BI.A.superclass._defaultConfig.apply(this, arguments); export class A extends BI.Text {
static xtype = "bi.a";
constructor() {
super();
}
// TODO:这里如何修改有问题
_defaultConfig() {
var conf = super._defaultConfig(arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-a display-block", baseCls: (conf.baseCls || "") + " bi-a display-block",
href: "", href: "",
@ -17,18 +23,19 @@ BI.A = BI.inherit(BI.Text, {
el: null, el: null,
tagName: "a", tagName: "a",
}); });
}, }
render: function () { render() {
var o = this.options; var o = this.options;
BI.A.superclass.render.apply(this, arguments); super.render();
this.element.attr({ href: o.href, target: o.target }); this.element.attr({ href: o.href, target: o.target });
if (o.el) { if (o.el) {
BI.createWidget(o.el, { BI.createWidget(o.el, {
element: this, element: this,
}); });
} }
}, }
});
}
BI.shortcut("bi.a", BI.A); BI.extend(BI, { A });

Loading…
Cancel
Save