// 定义侧边栏显示与否 import { defineStore } from "pinia"; // 若用Pinia,若用Vuex类似 export const useSliderStore = defineStore("slider", { state: () => ({ // 其他原有状态... sidebarShow: false, // 新增:侧边栏显示状态(全局存储) }), actions: { // 新增:更新侧边栏显示状态的方法 updateSidebarShow(show) { this.sidebarShow = show; }, }, });