[]let btn:Button = cell.getChildByName("button的name");
import Button = laya.ui.Button;
let itemBtn:Button = cell.getChildByName("mItemBtn");
这样会报一个错:Type "Node" is not assignable to type "Button". Property "toggle" is missing in type "Node";
对着官网list例子做的,不知道为啥会报这个错?
let itemBtn:Button = cell.getChildByName("mItemBtn");
这样会报一个错:Type "Node" is not assignable to type "Button". Property "toggle" is missing in type "Node";
对着官网list例子做的,不知道为啥会报这个错?
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
小伦
赞同来自:
需要将Node转为Button
let itemBtn:Button = cell.getChildByName("mItemBtn") as Button;即可