【VUE】异步等待,同步调接口

it2025-10-11  4

一、使用 async await 方法 async mouseleave(e,node,data){ this.qwer = data.dataID; await this.$refs.rightContent.mouseleave(this.qwer) // 调用 rightContent 组件中的 方法 await this.$refs.rightContent.callchildmethod(); }, 二、使用 this.$nextTick(()=>{{}), 这个方法就相当于 setTimeout mouseleave(e,node,data){ var that = this; this.qwer = data.dataID; this.$refs.rightContent.mouseleave(this.qwer) // 调用 rightContent 组件中的 方法 this.$nextTick(()=>{ that.$refs.rightContent.callchildmethod(); }) },

 

最新回复(0)