使用node.js中遇到的一些小bug

1、BUG Cannot set headers after they are sent to the client

解决:即发出一次请求得到两次或以上的回应时会出现此警告,此时注意查看再在一些条件下是否有使用return终止请求

2、地址栏怪异问题....id=%209

在html中查看时链接是这样的

但当点击跳转时,网址栏却是这样的

该问题是由于在"id= 20" 中存在了空格,将空格去掉之后就可以解决问题

3、使用express时候req.query()提示

query is not   a  functoin

是一个属性

bug将data设置为 这种格式的时候会使得输出的data为序列化呃呃不是对象

data:{data:data},

4、若没有使用语法时,则不需要使用占位符$

<script type="text/html" id="td">
  <p><strong>Id:</strong>{{data.id}}</p>
  <p><strong>姓名:</strong>{{data.name}}</p>
  <p><strong>性别:</strong>{{data.gender}}</p>
  <p><strong>地址:</strong>{{data.gender}}</p>
  <p><strong>添加时间:</strong>{{data.cTime}}</p>
</script>

猜你喜欢

转载自www.cnblogs.com/axu1997/p/12110476.html