Vue父子组件值同步和方法执行顺序问题

代码结构:三层关系:PrototypeDrawer>TaskDrawerHeader>TaskStatusPrototypeDrawer.vue 最外层<task-drawer-header @beforeComplete="beforeComplete"></task-drawer-header><script>export default { methods:{ openDrawer(){ t.
摘要由CSDN通过智能技术生成

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tUSHeW62-1648450832702)(D:\Markdown图片\image-20220325113335068.png)]

代码结构:

三层关系:PrototypeDrawer>TaskDrawerHeader>TaskStatus

PrototypeDrawer.vue 最外层

<task-drawer-header 
	@beforeComplete="beforeComplete">
</task-drawer-header>

<script>
export default {
    methods:{
        openDrawer(){
          this.queryDemAttachRel();
    	},
        queryDemAttachRel(){
          this.demAttachRelListQuery.id = this.currentTask.iteraId;
          this.demAttachRelListQuery.prodId = this.currentTask.prodId;
          designApi.queryDemAttachRel(this.demAttachRelListQuery).then(response => {
            this.demAttachRelList = response.data.data
            // 页面加载查询到需求列表,之后可以查询需求关联的UI人员列表长度
            this.queryUIListLength();
          })
        },
        beforeComplete() {
          console.log("beforeComplete执行开始")
          // 这里的UIList不能在这个方法中使用async+awit同步获取,会打乱方法执行顺序,所以在打开这个页面就加载获取
          // 如果需求中有一个没关联UI人员就不生成任务,并且停止子组件完成任务
          if (this.UIList.length !== this.demAttachRelList.length) {
            // 不管是否使用sync后缀修饰属性都没有效果 可能在调用栈中属性值无法及时更新
            sessionStorage.setItem("stopComplete","true");
            console.log("PrototypeDrawer是否停止",sessionStorage.getItem("stopComplete"))
            M
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王景清

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值