照着网上做了个输入文本框,想问个初级点的问题
追加文本用的 this.testMsg_Label.string += this.edtMsg_EditBox.string + ‘\n’;
如果只保留若干行文本,前面输入的字符串怎么去掉?
是搞个数组[]push进去再把它去掉吗?
properties: {
testMsg_Label: cc.Label,
testMsg_scrollView: cc.ScrollView,
edtMsg_EditBox: cc.EditBox,
},
addMsg(msg) {
if (this.edtMsg_EditBox.string != '') {
this.testMsg_Label.string += this.edtMsg_EditBox.string + '\n';
this.edtMsg_EditBox.string = '';
}
},