It's looking a bit confused, in the way that you have 3 "cart"s:
- 1 component
- 1 component computed property
- 1 data property
In your cart component:
-
totalwill point to the component's (computed) total, which is why it works. -
cart.totalpoints to the passed propcartwhich looks like a normal JS Object, stored indatawhich has a propertyproductsbut nototalproperty (computed or otherwise)
I'd suggest:
- renaming all your objects so you only have one of each
- using a shared store object, perhaps
ProductStoreand passing that around
You can make a store object either as a POJO (plain old JavaScript Object) which won't have access to computed properties, or as a Vue instance, which will - so then you can have all properties in one place, and do something like: store.products and store.total or even store.getTotal()