解决: 通过以上分析,强制赋值应该在前次赋值并且DOM已经刷新完毕以后进行。可使用$nextTick,如下是代码:git
handleTabClick (tab) { let name = this.filter1.tab this.$router.push({name}) if (tab.name == 'second') { this.$nextTick(() => { this.filter1.tab = 'first' }) } },
出处:https://lastvigo.github.io/2019/02/25/%E7%94%B1el-tabs%E4%BD%BF%E7%94%A8%E8%B0%88Vue%E6%B8%B2%E6%9F%93%E6%9C%BA%E5%88%B6/github