搜索结果列表页面开发
This commit is contained in:
19
src/utils/hooks/useLoginCheck.ts
Normal file
19
src/utils/hooks/useLoginCheck.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useAccountStore } from '@/stores/user';
|
||||
import { emitEvent } from '@/utils/eventBus';
|
||||
|
||||
/**
|
||||
* 验证登录转态,可触发登录操作
|
||||
* @returns
|
||||
*/
|
||||
export function useLoginCheck() {
|
||||
const account = useAccountStore();
|
||||
const loginCheck = (triggerType?: string) => {
|
||||
if (!account.isLogin) {
|
||||
emitEvent('login', { triggerType });
|
||||
}
|
||||
return account.isLogin;
|
||||
};
|
||||
return {
|
||||
loginCheck
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user