|
想使用代码动态生成Timer,于是借鉴了案例中的demo.
部分代码如下:
Model.prototype.button4Click = function(event){
if(!this.dtimer){
var option = {model:this,onTimer:this.dtimerTimer.bind(this)};
var interval = this.comp('inputInterval').val();
if(interval){
option.interval = justep.String.toInt(interval, 1000);
}
var times = this.comp('inputTimes').val();
if(times){
option.times = justep.String.toInt(times, 0);
}
option.xid = 'newxid';
this.dtimer = new Timer(option);
alert(this.dtimer.getXid());
}
};
把上面代码放进了 从数据新增一行数据之后的事件里(AfterNew): Model.prototype.detailDataAfterNew = function(event){ }
提示:Cannot read property 'bind' of undefined
顶部已经引入了 var Timer = require("$UI/system/components/justep/timer/timer");
不知问题出在哪里??
|
|