多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 使用 ### 注册 ``` import { createApp } from 'vue' import { createPinia } from 'pinia' import App from './App.vue' const pinia = createPinia() const app = createApp(App) app.use(pinia) app.mount('#app') ``` ### 组合式基础示例 ``` import {defineStore} from 'pinia'; import {ref} from 'vue'; export const businessStore = defineStore('business', ()=>{ const business= ref({ business_id:"", business_name:"", }); const save_business=(data)=>{ business.value.business_id=data?.business_id; business.value.business_name=data?.business_name; } const get_business_id=()=>{ return business.value.business_id } const get_business_name=()=>{ return business.value.business_name } return { business, save_business, get_business_id, get_business_name } }); ```