js 往数组最前和最后插入数据
展开阅读全文

最前插入数据

var data = {
        at_id: this.params.at_id,
        parent_id: this.params.p_id,
        member_id: this.params.member_id,
        comment: this.params.comment,
        ms_nickname: this.params.at_name,
        avatar: this.memberInfo.avatar,
        nickname: this.params.username,
        created_at: new Date().getTime() / 1000
}

this.comment_lists.splice(0, 0, data) 最后插入数据 this.comment_lists.push(data)