pvincent
4 years ago
3 changed files with 56 additions and 24 deletions
@ -1,7 +1,24 @@ |
|||
import { reactive } from "vue" |
|||
import { computed, reactive, readonly } from "vue" |
|||
|
|||
export default { |
|||
state: reactive({ |
|||
count: 404 |
|||
|
|||
const state = reactive({ |
|||
count: 0, |
|||
}) |
|||
|
|||
const ttc = computed( |
|||
() => state.count * 1.085 |
|||
) |
|||
|
|||
const inc = (amount: number): number => { |
|||
return (state.count += amount) |
|||
} |
|||
|
|||
function reset(): number { |
|||
return state.count = 0 |
|||
} |
|||
|
|||
export default { |
|||
state: readonly(state), |
|||
getters: { ttc }, |
|||
actions: { inc, reset } |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue