vue列表渲染组件不能更新

使用vue列表渲染组件不能更新,使用pid作为key,key是不同的。但是组件并没有更新

        <Row class="ivu-row" v-for="info in thisHostInfos" v-bind:key="info.pid">
            ...
        </Row>

在method中我更新了 thisHostInfos这个数组:

            reboot(host, pid) {
                axios.get("http://127.0.0.1:5000/reboot", {
                    params: {
                        host,
                        pid
                    }
                }).then(response => {
                    this.thisHostInfos = response.data;
                    this.$Notice.open({
                        title: "应用重启",
                        desc: "重启成功!"
                    });
                }).catch(function (error) {
                    console.log(error);
                    this.$Notice.open({
                        title: "应用重启",
                        desc: "重启失败!"
                    });
                })
            }
阅读 2.8k
3 个回答

建议使用vue devTools 看看数据确实更新了吗?

response 变量加个括号 (response)试试

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题