11<script setup lang="ts">
2- import { ref , type Component } from ' vue'
2+ import { computed , ref , type Component } from ' vue'
33import { LOGIN_METHOD } from ' @/api/enums'
44import LDAP from ' ./components/LDAP.vue'
55import CAS from ' ./components/CAS.vue'
@@ -21,21 +21,30 @@ const authenticationTabs: AuthenticationTab[] = [
2121 { label: ' OAuth2' , name: LOGIN_METHOD .OAUTH2 , component: OAuth2 },
2222 { label: ' 扫码登录' , name: ' SCAN' , component: SCAN },
2323]
24+ const activeAuthenticationComponent = computed (() => authenticationTabs .find ((tab ) => tab .name === activeName .value )?.component )
2425 </script >
2526
2627<template >
2728 <MkViewLayout class="system-settings-authentication">
28- <el-tabs v-model =" activeName" class =" authentication-tabs min-h-0 flex-1 flex-col" >
29- <template v-for =" authenticationTab in authenticationTabs " :key =" authenticationTab .name " >
30- <el-tab-pane class =" h-full" :label =" authenticationTab.label" :name =" authenticationTab.name" lazy >
31- <el-scrollbar >
32- <div class =" py-4" >
33- <component :is =" authenticationTab.component" />
34- </div >
35- </el-scrollbar >
36- </el-tab-pane >
37- </template >
38- </el-tabs >
29+ <template #default =" { title , Header } " >
30+ <component :is =" Header" >
31+ <div class =" w-full" >
32+ <h4 class =" mb-4" >{{ title }}</h4 >
33+ <el-tabs v-model =" activeName" >
34+ <el-tab-pane
35+ v-for =" authenticationTab in authenticationTabs"
36+ :key =" authenticationTab.name"
37+ :label =" authenticationTab.label"
38+ :name =" authenticationTab.name"
39+ />
40+ </el-tabs >
41+ </div >
42+ </component >
43+
44+ <KeepAlive >
45+ <component :is =" activeAuthenticationComponent" :key =" activeName" />
46+ </KeepAlive >
47+ </template >
3948 </MkViewLayout >
4049</template >
4150
0 commit comments