cc.Class({ extends: cc.Component, properties: { grantName: { default: null, type: cc.Label, serializable: true, }, amount: { default: null, type: cc.Label, serializable: true, }, //介绍 describe: { default: null, type: cc.Label, serializable: true, }, inputInviteValue: { default: 1, visible: false }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, /** * 赠送 */ onGrant(){ }, setInfo(grantName,amount){ this.grantName.string = grantName; this.amount.string = amount; }, inputValue(value, e) { var numberTemp = new RegExp("^[A-Za-z0-9]+$"); if (numberTemp.test(value)) { if(Number(value)>=1){ this.inputInviteValue = Number(value); }else{ this.inputInviteValue = 1; this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue; } } else { this.inputInviteValue = 1; this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue; console.log("请输入整数的倍数", this.inputInviteValue); } }, onclose(){ this.node.destroy(); } });