zoukankan      html  css  js  c++  java
  • webpack_vue发表新评论展示最新评论

    this.$http
              .post("api/postcomment/" + this.id, { content: this.msg.trim() })
              .then(res => {
                if (res.body.status == 0) {
                  this.list.unshift({
                    add_time: Date.now(),
                    content: this.msg.trim(),
                    user_name: "aaa"
                  });

                  this.msg = "";
                }
              });
     
     
    发表完评论无需重新调用获取评论函数,直接在list中追加数据实现双向数据绑定,页面就实时展示出来,最新的评论内容也已经成功写入数据库中,下次刷新也会展示出来
  • 相关阅读:
    LVS DR实验!
    Memcached 与 Redis 区别
    LVS笔试题!
    并发编程拓展知识
    并发编程之协程
    并发编程之线程
    并发编程之多道技术
    粘包问题与socketserver实现并发
    套接字通信
    git的使用
  • 原文地址:https://www.cnblogs.com/uniapp1/p/13461716.html
Copyright © 2011-2022 走看看