所以这就是我希望达到的结果
<div id=wrapper>
<div id=columns>
<div class=pin>
<p><img src=image.jpg><br>somename</p>
</div>
<div class=pin>
<p><img src=image2.jpg><br>somename2</p>
</div>
</div>
</div>
这是我在 Ext.DataView 中的当前 itemTpl 代码
itemTpl: '<div id=wrapper><div id=columns><tpl for=products><div class=pin><p><img src={image}><br>{name}</p></div></tpl></div></div>'
目前我的代码返回:
<div id=wrapper>
<div id=columns>
<div class=pin>
<p><img src=image.jpg><br>somename</p>
</div>
</div>
</div>
<div id=wrapper>
<div id=columns>
<div class=pin>
<p><img src=image2.jpg><br>somename2</p>
</div>
</div>
</div>
我的商店/JSON 如下所示:
Ext.define('Sencha.store.HoardList',{
extend: 'Ext.data.Store',
storeId: 'Plist',
model:'Sencha.model.HoardList',
title: 'My Collection',
autoLoad: true,
proxy: {
type: 'ajax',
url : 'products.json',
reader: {type: 'json', rootProperty:'products'}
}
});
json
{
"success": true,
"products": [
{"name": "Product A", "image": "images/product.jpg", "type": "shoe", "brand":"Nike", "color":"red"},
{"name": "Product B", "image": "images/product.jpg", "type": "short", "brand":"Nike", "color":"black"}
]
}
代码显然不像我想象的那样工作。所以我的问题是,如何添加包装器将 itemTpl 代码接地?非常感谢!