mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): add pinia setup syntax example: setup-store[添加setup syntax的pinia示例setup-store]
This commit is contained in:
@ -3,3 +3,4 @@ export * from './theme';
|
||||
export * from './auth';
|
||||
export * from './tab';
|
||||
export * from './route';
|
||||
export * from './setup-store';
|
||||
|
26
src/store/modules/setup-store/index.ts
Normal file
26
src/store/modules/setup-store/index.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useBoolean } from '@/hooks';
|
||||
|
||||
export const useSetupStore = defineStore('setup-store', () => {
|
||||
const { bool: visible, setTrue: show, setFalse: hide } = useBoolean();
|
||||
|
||||
interface Config {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const config = reactive<Config>({ name: 'config' });
|
||||
|
||||
/** 设置配置 */
|
||||
function setConfig(conf: Partial<Config>) {
|
||||
Object.assign(config, conf);
|
||||
}
|
||||
|
||||
return {
|
||||
visible,
|
||||
show,
|
||||
hide,
|
||||
config,
|
||||
setConfig
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user