Created
February 21, 2023 19:29
-
-
Save fazaio/24c6b80edcb4522662568082a7ff2f11 to your computer and use it in GitHub Desktop.
vue3 pinia typescript initialize declare variable ref array using interface typescript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface orderCart { | |
id_product: number; | |
total_product: number; | |
} | |
state: () => { | |
return { | |
allProduct: [], | |
totalAll: "", | |
checkoutItem: ref<Array<orderCart>>([]), | |
}; | |
} | |
addToCart(total_product: number, id_product: number) { | |
const obj = { | |
id_product: id_product, | |
total_product: total_product, | |
}; | |
this.checkoutItem?.push(obj); | |
console.log(obj); | |
}, | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment