由於通過路由跳轉到其他組件時,一些鈎子函數將失效,所以更新頁面數據就會失敗。
解決辦法:使用計算屬性:computed
computed:{ getBlog: function() { return this.blogs.filter(x=>x.blogUser === this.userName) } }
以下使用該方法:
<el-table :data="getBlog.filter(data => !search || data.blogName.toLowerCase().includes(search.toLowerCase()))" style="width: 100%">