You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
434 B
24 lines
434 B
import { computed, reactive, readonly } from 'vue'
|
|
|
|
//CONSTANTS
|
|
const TVA = 8.5
|
|
|
|
//STATE
|
|
const state = reactive({
|
|
count: 0
|
|
})
|
|
|
|
//COMPUTED
|
|
const ttc = computed(() => (state.count * (100 + TVA)) / 100)
|
|
|
|
//ARROW FUNCTION
|
|
const inc = (amount: number): number => {
|
|
return (state.count += amount)
|
|
}
|
|
|
|
//STANDARD FUNCTION
|
|
function reset(): number {
|
|
return (state.count = 0)
|
|
}
|
|
|
|
export default { state: readonly(state), ttc, inc, reset }
|