Problems with vue non-parent-child component communication (passing values and invoking component methods)

for example, I have two module components: one is the attribute module and the other is the login module. These two modules are not father-son relationship.
there is a function to open a list in the properties module, but it can only be used after logging in. So if you are not logged in, the trigger function will pop up the login module first (via vuex and el-element). But I think there will be a callback after the login module completes the login function. Can complete the event of opening the list.

attribute module:

<template>
    <div>
        <button @click=open></button>
        <el-dialog></el-dialog>
    </div>
</template>
<script>
method:{
    open(){
        if(){
        showDialog(){}
        }else{
         
        }
    }
    showDialog(){dialog}
}
</script>   

:
<template>
    <div>
        <el-dialog>
        <button @click=open></button>
        </el-dialog>
    </div>
</template>
<script>
method:{
    login(){}
}
</script>  


Sep.01,2021

you can register an object event call, monitor and distribute objects globally to meet such business requirements


in the form of cache. If there is a login, the login data is stored in the local cache to determine whether there is login information in the module. If so, it will display normally, if not, open the pop-up box, if not, in the form of the city routing page. It is best to use router.beforeEach to judge global monitoring and jump to the corresponding page

Menu