init: 初始系统模板

This commit is contained in:
TsMask
2023-09-05 14:38:23 +08:00
parent a5bc16ae4f
commit 1075c8ae4f
130 changed files with 22531 additions and 1 deletions

31
src/store/modules/app.ts Normal file
View File

@@ -0,0 +1,31 @@
import { defineStore } from 'pinia';
/**应用参数类型 */
type AppStore = {
/**应用名称 */
appName: string;
/**应用标识 */
appCode: string;
/**应用版本 */
appVersion: string;
};
const useAppStore = defineStore('app', {
state: (): AppStore => ({
appName: import.meta.env.VITE_APP_NAME,
appCode: import.meta.env.VITE_APP_CODE,
appVersion: import.meta.env.VITE_APP_VERSION,
}),
actions: {
/**设置网页标题 */
setTitle(title?: string) {
if (title) {
document.title = `${title} - ${this.appName}`;
} else {
document.title = this.appName;
}
},
},
});
export default useAppStore;