其他分享
首页 > 其他分享> > vue3解决子组件onMounted在父组件之前完成onMounted

vue3解决子组件onMounted在父组件之前完成onMounted

作者:互联网

vue3解决子组件onMounted在父组件之前完成onMounted

watch(
//监听props里面的某个对象users,这里是 () =>{return props.users}的简写,
  () => props.users,
  (newValue, oldValue) => {
    if (newValue.length > 0) {
//得到新值后再进行下一步操作
      isShow.value = true;
      accountId.value = newValue[0].id;
      $emit("tabclick", props.users[0]);
    }
  }
);

标签:users,vue3,onMounted,value,props,组件,newValue
来源: https://www.cnblogs.com/sunnybob/p/16382447.html