Authored by xuqi

goods partial

@@ -36,6 +36,12 @@ const index = (req, res) => { @@ -36,6 +36,12 @@ const index = (req, res) => {
36 page: pageNum, // current page: http://host/?page=2 36 page: pageNum, // current page: http://host/?page=2
37 limit: 10, // per_page records' number 37 limit: 10, // per_page records' number
38 totalRows: 100 // total page number 38 totalRows: 100 // total page number
  39 + },
  40 + goods: {
  41 + img: 'http://placehold.it/274x366',
  42 + link: '',
  43 + name: 'Fred Perry Bomber jacket',
  44 + price: '1015.00'
39 } 45 }
40 }, 46 },
41 helpers: { 47 helpers: {
1 <style> 1 <style>
2 - p { 2 + .title {
3 padding: 10px 0; 3 padding: 10px 0;
4 } 4 }
5 5
@@ -13,40 +13,40 @@ @@ -13,40 +13,40 @@
13 </style> 13 </style>
14 <div class="demo-page blk-page"> 14 <div class="demo-page blk-page">
15 {{# content}} 15 {{# content}}
16 - <p>1.复选按钮</p> 16 + <p class="title">1.复选按钮</p>
17 {{#each checkbox}} 17 {{#each checkbox}}
18 {{> checkbox}} 18 {{> checkbox}}
19 <br><br> 19 <br><br>
20 {{/each}} 20 {{/each}}
21 21
22 - <p>2.单选按钮</p> 22 + <p class="title">2.单选按钮</p>
23 {{#each radio}} 23 {{#each radio}}
24 {{> radio}} 24 {{> radio}}
25 <br><br> 25 <br><br>
26 {{/each}} 26 {{/each}}
27 27
28 - <p>3. 按钮</p> 28 + <p class="title">3. 按钮</p>
29 <span class="btn">普通按钮</span> 29 <span class="btn">普通按钮</span>
30 <span class="btn disable">不可点按钮</span> 30 <span class="btn disable">不可点按钮</span>
31 <span class="btn red">红色按钮</span> 31 <span class="btn red">红色按钮</span>
32 <span class="btn white">白色按钮</span> 32 <span class="btn white">白色按钮</span>
33 33
34 - <p>4. 提示文字或者某些链接文字颜色</p> 34 + <p class="title">4. 提示文字或者某些链接文字颜色</p>
35 <span class="blue">提示文字</span> 35 <span class="blue">提示文字</span>
36 <a class="blue">Link text</a> 36 <a class="blue">Link text</a>
37 37
38 - <p>5. input</p> 38 + <p class="title">5. input</p>
39 <input class="input" type="text"> 39 <input class="input" type="text">
40 40
41 - <p class="bold">6.文字加粗</p> 41 + <p class="bold title">6.文字加粗</p>
42 42
43 - <p>7. 浮动和clearfix</p> 43 + <p class="title">7. 浮动和clearfix</p>
44 <div class="clearfix" style="width: 300px;border: 1px solid #000;"> 44 <div class="clearfix" style="width: 300px;border: 1px solid #000;">
45 <p class="left">左浮动</p> 45 <p class="left">左浮动</p>
46 <p class="right">右浮动</p> 46 <p class="right">右浮动</p>
47 </div> 47 </div>
48 48
49 - <p>8. 显示和隐藏</p> 49 + <p class="title">8. 显示和隐藏</p>
50 <div style="border: 1px solid #000;"> 50 <div style="border: 1px solid #000;">
51 <p><span class="hide">我是存在的</span>(左边有个家伙消失啦)</p> 51 <p><span class="hide">我是存在的</span>(左边有个家伙消失啦)</p>
52 <p><span class="block">我是block</span></p> 52 <p><span class="block">我是block</span></p>
@@ -54,9 +54,14 @@ @@ -54,9 +54,14 @@
54 <p><span class="vhide">我是存在的</span>(左边有个家伙隐身了)</p> 54 <p><span class="vhide">我是存在的</span>(左边有个家伙隐身了)</p>
55 </div> 55 </div>
56 56
57 - <p>9. 分页组件</p> 57 + <p class="title">9. 分页组件</p>
58 <div style="border: 1px solid #000; height: 40px; padding: 5px;"> 58 <div style="border: 1px solid #000; height: 40px; padding: 5px;">
59 {{{ pagination paginationOpts }}} 59 {{{ pagination paginationOpts }}}
60 </div> 60 </div>
  61 +
  62 + <p class="title">10. 商品信息</p>
  63 + {{# goods}}
  64 + {{> goods}}
  65 + {{/ goods}}
61 {{/ content}} 66 {{/ content}}
62 </div> 67 </div>
  1 +<div class="goods-info" data-skn="{{skn}}">
  2 + <a href="{{link}}" target="_blank">
  3 + <img class="lazy thumb" data-original="{{img}}">
  4 + </a>
  5 + <div class="desc">
  6 + <a class="name" href="{{link}}" target="_blank">{{name}}</a>
  7 + <p class="price">{{price}}</p>
  8 + </div>
  9 +</div>
  1 +var $ = require('yoho-jquery'),
  2 + lazyLoad = require('yoho-jquery-lazyload');
  3 +
  4 +lazyLoad($('img.lazy'));
  1 +.goods-info {
  2 + width: 274px;
  3 + margin-right: 18px;
  4 +
  5 + .thumb {
  6 + width: 100%;
  7 + height: 366px;
  8 + }
  9 +
  10 + .desc {
  11 + text-align: center;
  12 + }
  13 +
  14 + .name {
  15 + font-size: 14px;
  16 + line-height: 50px;
  17 + }
  18 +
  19 + .price {
  20 + font-size: 16px;
  21 + font-weight: bold;
  22 + }
  23 +}
1 -@import "pagination"; 1 +@import "pagination"; /* 分页 */
  2 +@import "goods"; /* 商品 */