Hi all !!
I’m learning the basics and I’m on the subject (Create a list of dynamically generated content).
but the Label or the images are not published.
I am aware that it is level (hello world) but must start.
my work !!!
ItemList.js
ItemTemplate.js
ItemList
ItemTemplate
assets
Label Name Stock Price
Canvas
the problem comes from init, I think
Blockquote
// line (41) ItemList.js
item.getComponent('ItemTemplate').init({
id: data.id,
iconSF: data.iconSF,
itemName: data.itemName,
itemStock: data.itemStock,
itemPrice: data.itemPrice
}
// line (16) ItemTemplate
init: function (data) {
this.id = data.id;
this.icon.spriteFrame = data.iconSF;
this.itemName.string = data.itemName;
this.itemStock.string = data.itemStock;
this.itemPrice.string = data.itemPrice
},
I’m on the page List with Data · Cocos Creator
the Prefab is displayed. the LabelName does not become ItemName, same for price, stock .
Thank you in advance for your reply