在使用localStorage存储token和用户头像时,由于heard组件已经加载完毕,无法更新实时登录信息,所以采用以下方式进行强制刷新。 toView(row) { this.forceRefresh = false // 强制刷新子组件 this.$nextTick(() => { this.forceRefresh = true })}因为父组件有缓存等因素,子组件创建后没有释放,传入参数无效,使用v-if的特性(销毁和重建)可以强制刷新子组件