尧图网站设计 尧图网站设计YAOTU DESIGN
ARTICLE DETAIL

资讯详情

深耕网站设计与一线实操的经验洞察。

Vue3+SpringBoot4 从零搭建后台管理系统【第四篇】安装状态管理库 Pinia

Vue3+SpringBoot4 从零搭建后台管理系统【第四篇】安装状态管理库 Pinia 1、安装 Pinia 依赖pnpm install pinia2、配置 Pinia在 main.ts 中引入import { createApp } from vue // import ./style.css import App from ./App.vue import router from ./router/index import ElementPlus from element-plus import zhCn from element-plus/es/locale/lang/zh-cn import element-plus/dist/index.css import * as ElementPlusIconsVue from element-plus/icons-vue // 引入 Pinia import { createPinia } from pinia // 创建 Pinia 实例 const pinia createPinia() const app createApp(App) app.use(router) app.use(ElementPlus, { locale: zhCn, }) // 使用 pinia app.use(pinia) app.mount(#app) for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app.component(key, component) }
返回列表