underscore.js 数组拆分新问题
var message =message:
[ {n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"在吗555",date:"2010-12-23"},
{n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"回来了吗",date:"2019-12-23"},
{n:"刘云",a:"static/images/ly.jpg",from:"10", to: "1",msg:"回来了:)",date:"2019-12-3"},
{n:"刘云",a:"static/images/ly.jpg",from:"10", to: "1",msg:"给你带了东西",date:"2019-12-23"},
{n:"刘云",a:"static/images/ly.jpg",from:'10', to: "1",msg:"累死了",date:"2012-1-1"},
{n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"在吗555bbbbbb",date:"2010-12-23"},
{n:"刘云",a:"static/images/ly.jpg",from:'10', to: "1",msg:"累死了333333",date:"2012-1-1"},
];
拆分为:
var message =message:
[ [{n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"在吗555",date:"2010-12-23"},
{n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"回来了吗",date:"2019-12-23"}],
[{n:"刘云",a:"static/images/ly.jpg",from:"10", to: "1",msg:"回来了:)",date:"2019-12-3"},
{n:"刘云",a:"static/images/ly.jpg",from:"10", to: "1",msg:"给你带了东西",date:"2019-12-23"},
{n:"刘云",a:"static/images/ly.jpg",from:'10', to: "1",msg:"累死了",date:"2012-1-1"}],
[{n:"jerry",a:"static/images/liuyan.jpg",from:"1", to: "10",msg:"在吗555bbbbbb",date:"2010-12-23"}],
[{n:"刘云",a:"static/images/ly.jpg",from:'10', to: "1",msg:"累死了333333",date:"2012-1-1"}]
];
每次收到对方的新消息,需要另起一行,如果一直是自己说话,内容还在这行里面。
如何用underscore 实现。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论