问题
Here's mytable.js:
var items = [
{code: 'A1', name: 'Soda1', description: 'desc1'},
{code: 'A2', name: 'Soda2', description: 'desc2'},
{code: 'A3', name: 'Soda3', description: 'desc3'},
{code: 'A4', name: 'Soda4', description: 'desc4'},
{code: 'A5', name: 'Soda5', description: 'desc5'},
{code: 'A6', name: 'Soda6', description: 'desc6'},
{code: 'A7', name: 'Soda7', description: 'desc7'},
{code: 'A8', name: 'Soda8', description: 'desc8'},
{code: 'A9', name: 'Soda9', description: 'desc9'},
{code: 'A10', name: 'Soda10', description: 'desc10'},
{code: 'A11', name: 'Soda11', description: 'desc11'}
];
res.render('mytable', {
items: items
})
And here's mytable.jade:
table(border='1')
thead
tr
th #
th Code
th Name
th Description
tbody
each item, i in items
tr
td= i+1
td= item.code
td= item.name
td= item.description
This is the result:
This is what I need:
How can I edit mytable.jade
so the result comes out the way I need it?
来源:https://stackoverflow.com/questions/28187290/how-rotate-html-table-using-jade-template-node-express-jade