How to realize this kind of registration switching effect by using vue framework

how do you realize that a registration page needs to switch between individual registration and institutional registration?

clipboard.png

May.27,2021

v-if/v-else or v-show isn't it over.


similar to the tab component, the content registered by an individual / institution is written as two components, view1,view2. Define a variable currentView, that defaults to view1.

<component :is="currentView"></component>

the two buttons above toggle the value of currentView when clicked.


A router-view, in the parent component clicks to switch routes to redirect


routes (reasonable is not recommended, and the organization is a bit complicated), v-if/v-show (reasonable is not good for maintenance), and two components (dynamic components, there are actually a little more similarities with the two components of keep-alive, but it will be clearer for each to maintain its own data). From a simple and easy-to-understand point of view, I recommend vMurshow, the component form should be a little more practical

Menu