mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-12 11:43:42 +08:00
feat(projects): 添加多页签风格:按钮和浏览器两种风格
This commit is contained in:
@@ -3,5 +3,6 @@ import useContext from './useContext';
|
||||
import useRouterChange from './useRouterChange';
|
||||
import useRouteParam from './useRouteParam';
|
||||
import useRouteQuery from './useRouteQuery';
|
||||
import useBoolean from './useBoolean';
|
||||
|
||||
export { useAppTitle, useContext, useRouterChange, useRouteParam, useRouteQuery };
|
||||
export { useAppTitle, useContext, useRouterChange, useRouteParam, useRouteQuery, useBoolean };
|
||||
|
||||
24
src/hooks/common/useBoolean.ts
Normal file
24
src/hooks/common/useBoolean.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default function useBoolean(initValue: boolean = false) {
|
||||
const bool = ref(initValue);
|
||||
|
||||
function setTrue() {
|
||||
bool.value = true;
|
||||
}
|
||||
|
||||
function setFalse() {
|
||||
bool.value = false;
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
bool.value = !bool.value;
|
||||
}
|
||||
|
||||
return {
|
||||
bool,
|
||||
setTrue,
|
||||
setFalse,
|
||||
toggle
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user