mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-28 08:43:02 +08:00
11 lines
226 B
TypeScript
11 lines
226 B
TypeScript
import { ref } from 'vue';
|
|
|
|
export function useToggle(defaultValue = false) {
|
|
const state = ref(defaultValue);
|
|
const toggle = (value = !state.value) => {
|
|
state.value = value;
|
|
};
|
|
|
|
return [state, toggle] as const;
|
|
}
|