Commit 458a7926 authored by liujiangnan's avatar liujiangnan

feat: 兼容无图片情况

parent 1c8b2700
......@@ -276,9 +276,13 @@ export default class NewClass extends cc.Component {
itemClone.parent = wordRow;
itemClone.active = true;
cc.find("word", itemClone).getComponent(cc.Label).string = word.text;
getSpriteFrimeByUrl(word.pic_url, (spriteFrame) => {
cc.find("pic", itemClone).getComponent(cc.Sprite).spriteFrame = spriteFrame;
});
if (word.pic_url) {
getSpriteFrimeByUrl(word.pic_url, (spriteFrame) => {
cc.find("pic", itemClone).getComponent(cc.Sprite).spriteFrame = spriteFrame;
});
} else {
cc.find("pic", itemClone).active = false;
}
}
} else {
cc.find("word_title", resultNode).active = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment