Skip to content

Instantly share code, notes, and snippets.

@geckotang
Last active December 30, 2015 16:19
Show Gist options
  • Save geckotang/7853970 to your computer and use it in GitHub Desktop.
Save geckotang/7853970 to your computer and use it in GitHub Desktop.
block goods {
tag: 'ul'
content: {
var content = [];
this.ctx.goods.forEach(function(item){
var mods = {};
if (item.new) mods.new = 'yes';
content.push({
elem: 'item',
mods: mods,
content: [
{
elem: 'title',
content: {
block: 'b-link',
url: item.url,
content: item.title
}
},
{
elem: 'image',
src: item.image
},
{
elem: 'author',
content: item.author + '(著)'
},
{
elem: 'price',
content: {
block: 'b-link',
mix: [{ block: 'goods', elem: 'link' }],
url: item.url,
content: '¥' + item.price + 'で購入する'
}
}
]
});
});
return content;
}
elem item, tag: 'li'
elem title, tag: 'h3'
elem author, tag: 'div'
elem price, tag: 'div'
elem image {
tag: 'img'
attrs: {
src: this.ctx.src
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment