TakeOutShop/store/counter.js
2025-03-04 23:07:40 +08:00

23 lines
604 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineStore } from 'pinia';
import { computed,ref } from 'vue';
import { apiService } from "@/server/api.service";
export const useCounterStore = defineStore('counter',()=>{
//定义数据state)
const count = ref(0);
const openId = ref('');
const cellPhone = ref('');
const isLogin = ref('');
//定义数据修改的方法(action)
const clickSType = (params)=>{
return apiService.post('/product/getPictureShareUrl',params)
}
//定义getters
// const doubleCount = computed(()=>count.value * 2)
//以对象的形式return供组件调用
return{
count,
clickSType
}
})