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

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

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