initial commit
This commit is contained in:
20
app/composables/useCounter.ts
Normal file
20
app/composables/useCounter.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export const useCounter = () => {
|
||||
const counter = useState('counter', () => 0)
|
||||
const increment = () => {
|
||||
counter.value++
|
||||
}
|
||||
|
||||
const decrement = () => {
|
||||
counter.value--
|
||||
}
|
||||
|
||||
const reset = () => {
|
||||
counter.value=0
|
||||
}
|
||||
return {
|
||||
counter,
|
||||
increment,
|
||||
decrement,
|
||||
reset
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user