forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
7 years ago
|
/**
|
||
|
* Created by Dailer on 2017/7/11.
|
||
|
*/
|
||
|
Demo.AdaptEditor = BI.inherit(BI.Widget, {
|
||
|
props: {
|
||
|
baseCls: ""
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
//这东西好奇怪,不支持设置宽度,那么渲染出来宽度几乎没有,无奈之下只能假装给他个默认值了
|
||
|
beforeMounted: function () {
|
||
|
this.refs.setValue("Winter is coming !")
|
||
|
},
|
||
|
|
||
|
render: function () {
|
||
|
var self = this;
|
||
|
var editor = BI.createWidget({
|
||
|
type: "bi.adapt_editor",
|
||
|
cls: "layout-bg5",
|
||
|
ref: function (_ref) {
|
||
|
self.refs = _ref;
|
||
|
}
|
||
|
})
|
||
|
|
||
|
var text=["You know nothing! Jon Snow","A Lannister always pays his debts.","Power is a curious thing."]
|
||
|
|
||
|
return {
|
||
|
type: "bi.horizontal_auto",
|
||
|
items: [{
|
||
|
el: editor
|
||
|
}, {
|
||
|
type: "bi.button",
|
||
|
text: "为了展示长度真的是可变的,每点一下就换一行字",
|
||
|
handler: function () {
|
||
|
var temp=text.shift();
|
||
|
editor.setValue(temp);
|
||
|
text.push(temp);
|
||
|
}
|
||
|
}],
|
||
|
vgap: 20
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
BI.shortcut("demo.adapt_editor", Demo.AdaptEditor);
|