解决后加载页面赋值不渲染问题

1.问题原因:当前页面刷新,会关闭主页面,之后当前页面跳转到主页面并且赋值给主页面进行渲染,因为跳转过程中,赋值与页面加载同时进行,页面回流和重绘较多,可能造成资源阻塞,没有及时渲染或未渲染页面。

2.解决办法之一:
放入延时函数中赋值

//兄弟组件
import { event } from "./common/util";

 setTimeout(() => {
        event.$emit('getCheckBoxFlag', true); //详情页刷新时查询页面会关闭,放入延迟加载中等待查询页面加载后再赋值
      }, 1000);
      
//兄弟组件
import { event } from "./common/util";
mounted() {
	event.$on('flowInfo',res=>{
	     this.searchParam.evaluateStatus = res;
	     this.onSearch()
	    }).$on('getInquireClientId', clientId=>{
	      this.searchParam.clientId = clientId;
	      event.$emit('getWfListByClientIdAndTime', this.searchParam);
	    }).$on('getCheckBoxFlag', checkBoxFlag=>{ //接收值
	      this.checkBoxFlag = checkBoxFlag;
	      this.handleClickCheckBox();
	    }).$on('inquireListSearch', res=>{
	      this.onSearch();
	    })
	}	    
//common/util/even.js

import Vue from 'vue'

export default new Vue();

版权声明:本文为Winsom1原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。