makeRow : function() {
this.rowDiv = Y.Node.create("<div/>").addClass('rowDiv'),//.set('id', i),
this.rowUL = Y.Node.create("<ul/>").addClass('rowUL'),
this.handle = Y.Node.create("<li/>").addClass('handle'),
this.plusImg = Y.Node.create("<img/>").set('src', 'images/plus.png').addClass('plus'),
this.between = Y.Node.create("<div/>").addClass('between'),
this.rowDel = Y.Node.create("<img/>").addClass('rowDel').set('src', 'images/redx.png'),
this.rowDelLI = Y.Node.create("<li/>").addClass('delLI'),
this.expand = Y.Node.create("<li/>").addClass('expand').set('innerHTML', 'expand?');
this.rowUL.append(this.handle);
this.rowUL.append(this.expand);
this.rowDelLI.append(this.rowDel);
this.rowDiv.append(this.rowDel);
this.between.append(this.plusImg);
this.rowDiv.append(this.rowUL);
this.rowDiv.append(this.between);
this.expanded = false;
this.phrases = [];
this.hiddenPhrases = [];
//When I print this.rowDiv it returns the id, so hopefully I can treat this as a string of the id
this.rowDiv.parentMakeRow = this;
this.id = "<Object makeRow: id=" + id++ +">";
this.watch("rowUL", function(id, oldval, newval){
console.log('changed');
});
this.toString = function() {
return this.id;
}
是因为我使用文字符号吗?是因为这是封闭的吗?
我收到错误Uncaught TypeError:Object [object Object]没有方法&#39; watch&#39;
知道发生了什么事吗?