mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-27 12:08:49 +08:00
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import { access as accessApi, pinia, createWatermark } from '@fesjs/fes';
|
|
import { ref, watch } from 'vue';
|
|
import PageLoading from '@/components/pageLoading.vue';
|
|
import UserCenter from '@/components/userCenter.vue';
|
|
import { useStore } from '@/store/main';
|
|
|
|
export const beforeRender = {
|
|
loading: <PageLoading />,
|
|
action() {
|
|
const { setRole } = accessApi;
|
|
return new Promise((resolve) => {
|
|
setTimeout(() => {
|
|
const store = useStore(pinia);
|
|
store.$patch({
|
|
userName: '李雷',
|
|
});
|
|
setRole('admin');
|
|
resolve({
|
|
userName: '李雷',
|
|
});
|
|
createWatermark({ content: '万纯(harrywan)' });
|
|
}, 1000);
|
|
});
|
|
},
|
|
};
|
|
|
|
export const layout = (layoutConfig, { initialState }) => ({
|
|
...layoutConfig,
|
|
renderCustom: () => <UserCenter />,
|
|
menus: () => {
|
|
const menusRef = ref(layoutConfig.menus);
|
|
watch(
|
|
() => initialState.userName,
|
|
() => {
|
|
menusRef.value = [
|
|
{
|
|
name: 'store',
|
|
},
|
|
];
|
|
},
|
|
);
|
|
return menusRef;
|
|
},
|
|
});
|