Browse Source

feat: 修改bi.a

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

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

51
src/base/single/a/a.js

@ -6,29 +6,36 @@
* @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, {
baseCls: (conf.baseCls || "") + " bi-a display-block",
href: "",
target: "_blank",
el: null,
tagName: "a",
});
}
return BI.extend(conf, { render() {
baseCls: (conf.baseCls || "") + " bi-a display-block", var o = this.options;
href: "", super.render();
target: "_blank", this.element.attr({ href: o.href, target: o.target });
el: null, if (o.el) {
tagName: "a", BI.createWidget(o.el, {
element: this,
}); });
}, }
}
render: function () { }
var o = this.options;
BI.A.superclass.render.apply(this, arguments);
this.element.attr({ href: o.href, target: o.target });
if (o.el) {
BI.createWidget(o.el, {
element: this,
});
}
},
});
BI.shortcut("bi.a", BI.A); BI.extend(BI, { A });

Loading…
Cancel
Save