zoukankan      html  css  js  c++  java
  • express细节点注意

    删除 cookie 需要这么

    res.cookie('admin_uid',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
    res.cookie('admin_name',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
    res.cookie('admin_cname',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});
    res.cookie('admin_key',"null",{maxAge:0, httpOnly:true, path:'/',domain:'.oa.com'});

    要当场指定域

    Handlebars 模板引擎 加 全局 helper 需要这么

    var Handlebars = require('handlebars');
    var request = require('request');
    Handlebars.registerHelper('eq',function(num1,num2,options){
    if(num1==num2){
    return options.fn(this);
    }
    });

    先把 Handlebars 引进来

    循环体内取外部 模板变量需要加 ../

    {{#each lists}}
    <tr >
    <td><label class="check"><input type="checkbox" name="checkid[]" value="{{this._id}}" {{#eq this.mid ../user.mid}} cancheck='1' {{/eq}}></label></td>
    <td><a href="/content/{{this._id}}">{{this.title}}</a></td>
    <td>{{this.autor}}</td>
    <td id="isdel"><font color="blue">{{this.cname}}</font></td>
    <td>{{{this.statustxt}}}</td>
    <td>{{this.bollowcount}}</td>
    <td>{{this.createTime.minute}} {{cando}}</td>
    {{#if ../cando}}
    <td>
    {{#if canborrow}}
    <a href="javascript:;" class="btnn gray h24 lDisabled" data-id='{{this._id}}'>借书</a>
    {{/if}}
    {{#if canreback}}
    <a href="javascript:;" class="btnn gray h24 lEnable" data-id='{{this._id}}'>对方归还</a>
    {{/if}}
    {{#if canedit}}
    <a href="/newbook?id={{this._id}}" class="btnn gray h24 lEdit" data-id='{{this._id}}'>编辑</a>
    <a href="javascript:;" class="btnn gray h24 ldelete" data-id='{{this._id}}'>删除</a>
    {{/if}}
    </td>
    {{/if}}
    </tr>
    {{/each}}

  • 相关阅读:
    Day 03--设计与完善(一)
    Day 02--选题与设计(二)
    Day 01--选题与设计(一)
    课程设计第六天,08.24
    课程设计第五天,08.23
    课程设计第四天,08.22
    课程设计第三天,08.21
    软件课程设计第二天,08.20
    软件课程设计第一天
    旋转正方形
  • 原文地址:https://www.cnblogs.com/oastar/p/5146124.html
Copyright © 2011-2022 走看看