[]关于类中方法的调用
var FactionListItem = (function(_super){
function FactionListItem(data) {
FactionListItem.super(this);
this.updateLvAndPeopleCount();
this.updateLvAndPeopleCount = function(){
//-----
}
}
Laya.class(FactionListItem,"FactionListItem",FactionMainNodeUI);
return FactionListItem;
})();
在一个类里。。我可以用this.这样直接调用方法吗?我现在调用了会报错?
function FactionListItem(data) {
FactionListItem.super(this);
this.updateLvAndPeopleCount();
this.updateLvAndPeopleCount = function(){
//-----
}
}
Laya.class(FactionListItem,"FactionListItem",FactionMainNodeUI);
return FactionListItem;
})();
在一个类里。。我可以用this.这样直接调用方法吗?我现在调用了会报错?
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
ymsdandan
赞同来自:
15818760256
赞同来自:
Monica - 知识达人
赞同来自:
修改之后的代码:
var NpcLayer = (function(_super){
var m_talkScroll;
function NpcLayer(addrid) {
NpcLayer.super(this);
//文字滚动
// m_talkScroll = new UIScroll(610.0, 250);
// m_talkScroll.pos(0, 0);
// this.addChild(m_talkScroll);
// this.onAction();
// this.onAction = function(){
// console.log("-------------hhhhhhhhhhh ");
// }
//第一种解决方法
onAction();
function onAction(){
console.log("这是第一种解决方法");
}
//第二种解决方法
this.onAction();
}
Laya.class(NpcLayer,"NpcLayer",_super);
NpcLayer.prototype.onAction = function(){
console.log("这是第二种解决方法");
}
return NpcLayer;
})(Laya.Sprite);