Files
bio_frontend/composables/useCounter.ts

26 lines
367 B
TypeScript
Raw Normal View History

2025-08-08 13:11:33 +09:00
export const useCounter = () => {
const count = ref(0);
const increment = () => {
count.value++;
};
const decrement = () => {
count.value--;
};
const reset = () => {
count.value = 0;
};
const double = computed(() => count.value * 2);
return {
count: readonly(count),
increment,
decrement,
reset,
double,
};
};