Skip to content

Commit b65dff2

Browse files
committed
component.Legend: useIcon_ config #2106
1 parent 88cc512 commit b65dff2

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

src/component/Legend.mjs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ class Label extends Component {
2626
* @member {String} text_=''
2727
*/
2828
text_: '',
29+
/**
30+
* @member {Boolean} useIcon_=true
31+
*/
32+
useIcon_: true,
2933
/**
3034
* @member {Object} _vdom
3135
*/
3236
_vdom:
3337
{tag: 'legend', cn:[
34-
{vtype: 'text', removeDom: true},
38+
{vtype: 'text'},
3539
{vtype: 'text'}
3640
]}
3741
}}
@@ -44,7 +48,7 @@ class Label extends Component {
4448
*/
4549
afterSetIconCls(value, oldValue) {
4650
let vdom = this.vdom;
47-
vdom.cn[0].html = value;
51+
vdom.cn[0].html = `<i class="${value}"></i>`;
4852
this.vdom = vdom;
4953
}
5054

@@ -59,6 +63,18 @@ class Label extends Component {
5963
vdom.cn[1].html = value;
6064
this.vdom = vdom;
6165
}
66+
67+
/**
68+
* Triggered after the useIcon config got changed
69+
* @param {Boolean} value
70+
* @param {Boolean} oldValue
71+
* @protected
72+
*/
73+
afterSetUseIcon_(value, oldValue) {
74+
let vdom = this.vdom;
75+
vdom.cn[0].removeDom = !value;
76+
this.vdom = vdom;
77+
}
6278
}
6379

6480
Neo.applyClassConfig(Label);

0 commit comments

Comments
 (0)