cart.ts 373 B

123456789101112131415161718
  1. import { getProductShoppingCartCount } from '@/api/goods/index';
  2. export const cartStore = defineStore('cart', () => {
  3. const cartCount = ref<any>(0);
  4. const onCartCount = () => {
  5. getProductShoppingCartCount({}).then((res) => {
  6. if (res.code == 200) {
  7. cartCount.value = res.data;
  8. }
  9. });
  10. };
  11. return {
  12. cartCount,
  13. onCartCount
  14. };
  15. });