ljr-cli 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/{lib → bin}/demo1.js +1 -1
  2. package/{lib → bin}/demo2.js +1 -1
  3. package/{lib → bin}/index.js +2 -0
  4. package/{lib → bin}/templates/vue2.7.16/package.json +41 -41
  5. package/{lib → bin}/templates/vue2.7.16/pnpm-lock.yaml +5 -5
  6. package/{lib → bin}/templates/vue2.7.16/src/views/Pitfalls//345/206/205/345/255/230/346/272/242/345/207/272/index.vue +2 -2
  7. package/{lib → bin}/templates/vue2.7.16/src/views/demo//345/205/250/345/261/200store/346/225/260/346/215/256/345/255/227/345/205/270/index.vue +11 -11
  8. package/{lib → bin}/templates/vue2.7.16/src/views/demo//345/205/250/345/261/200/346/214/207/344/273/244/index.vue +10 -10
  9. package/{lib → bin}/templates/vue2.7.16/src/views/demo//350/257/267/346/261/202/347/244/272/344/276/213/index.vue +2 -2
  10. package/{lib → bin}/templates/vue2.7.16/src/views/login.vue +7 -7
  11. package/bin/templates/vue2.7.16/src/views/template/base-info2.vue +56 -0
  12. package/{lib → bin}/templates/vue2.7.16/src/views/template/list/index.vue +3 -3
  13. package/{lib → bin}/templates/vue3.5.25-2025.12.4/.vscode/settings.json +1 -1
  14. package/{lib → bin}/templates/vue3.5.25-2025.12.4/README.md +66 -35
  15. package/{lib → bin}/templates/vue3.5.25-2025.12.4/auto-imports.d.ts +12 -0
  16. package/{lib → bin}/templates/vue3.5.25-2025.12.4/components.d.ts +8 -0
  17. package/bin/templates/vue3.5.25-2025.12.4/env.d.ts +2 -0
  18. package/{lib → bin}/templates/vue3.5.25-2025.12.4/eslint.config.ts +1 -0
  19. package/{lib → bin}/templates/vue3.5.25-2025.12.4/package.json +3 -1
  20. package/{lib → bin}/templates/vue3.5.25-2025.12.4/pnpm-lock.yaml +558 -399
  21. package/bin/templates/vue3.5.25-2025.12.4/src/boot/pinia.ts +31 -0
  22. package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/boot/router.ts +2 -2
  23. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/header.vue +16 -0
  24. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/left-right.vue +28 -0
  25. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/menu.vue +12 -0
  26. package/bin/templates/vue3.5.25-2025.12.4/src/pages/[...404].vue +5 -0
  27. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/about.vue +7 -0
  28. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/index.vue +70 -0
  29. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index.vue +13 -0
  30. package/bin/templates/vue3.5.25-2025.12.4/src/pages/login.vue +76 -0
  31. package/bin/templates/vue3.5.25-2025.12.4/src/router/index.ts +28 -0
  32. package/bin/templates/vue3.5.25-2025.12.4/src/stores/account.ts +49 -0
  33. package/bin/templates/vue3.5.25-2025.12.4/src/stores/dd.ts +35 -0
  34. package/bin/templates/vue3.5.25-2025.12.4/src/stores/index.ts +3 -0
  35. package/bin/templates/vue3.5.25-2025.12.4/src/stores/layout.ts +22 -0
  36. package/bin/templates/vue3.5.25-2025.12.4/src/stores//347/273/204/345/220/210/345/274/217pinia/345/206/231/346/263/225(/344/273/245account/344/270/272/344/276/213).ts +28 -0
  37. package/{lib → bin}/templates/vue3.5.25-2025.12.4/tsconfig.app.json +1 -1
  38. package/bin/templates/vue3.5.25-2025.12.4/typed-router.d.ts +119 -0
  39. package/{lib → bin}/templates/vue3.5.25-2025.12.4/vite.config.ts +3 -1
  40. package/package.json +8 -7
  41. package/lib/templates/vue2.7.16/src/views/template/base-info2.vue +0 -56
  42. package/lib/templates/vue3.5.25-2025.12.4/env.d.ts +0 -1
  43. package/lib/templates/vue3.5.25-2025.12.4/src/boot/pinia.ts +0 -10
  44. package/lib/templates/vue3.5.25-2025.12.4/src/router/index.ts +0 -20
  45. package/lib/templates/vue3.5.25-2025.12.4/src/stores/counter.ts +0 -12
  46. package/lib/templates/vue3.5.25-2025.12.4/src/views/AboutView.vue +0 -3
  47. package/lib/templates/vue3.5.25-2025.12.4/src/views/HomeView.vue +0 -14
  48. package/{lib → bin}/templates/flutter//346/210/221/346/230/257flutter.txt +0 -0
  49. package/{lib → bin}/templates/java//346/210/221/346/230/257java.txt +0 -0
  50. package/{lib → bin}/templates/monorepo//346/210/221/346/230/257monorepo.txt +0 -0
  51. package/{lib → bin}/templates/mysql//346/210/221/346/230/257mysql.txt +0 -0
  52. package/{lib → bin}/templates/node//346/210/221/346/230/257node.txt +0 -0
  53. package/{lib → bin}/templates/qiankun//346/210/221/346/230/257qiankun.txt +0 -0
  54. package/{lib → bin}/templates/react//346/210/221/346/230/257react.txt +0 -0
  55. package/{lib → bin}/templates/uni-app//346/210/221/346/230/257uni-app.txt +0 -0
  56. package/{lib → bin}/templates/vue2.7.16/.browserslistrc +0 -0
  57. package/{lib → bin}/templates/vue2.7.16/.env +0 -0
  58. package/{lib → bin}/templates/vue2.7.16/.env.development +0 -0
  59. package/{lib → bin}/templates/vue2.7.16/.env.production +0 -0
  60. package/{lib → bin}/templates/vue2.7.16/.eslintignore +0 -0
  61. package/{lib → bin}/templates/vue2.7.16/.eslintrc.js +0 -0
  62. package/{lib → bin}/templates/vue2.7.16/.prettierrc.js +0 -0
  63. package/{lib → bin}/templates/vue2.7.16/.vscode/settings.json +0 -0
  64. package/{lib → bin}/templates/vue2.7.16/README.md +0 -0
  65. package/{lib → bin}/templates/vue2.7.16/babel.config.js +0 -0
  66. package/{lib → bin}/templates/vue2.7.16/jsconfig.json +0 -0
  67. package/{lib → bin}/templates/vue2.7.16/public/favicon.svg +0 -0
  68. package/{lib → bin}/templates/vue2.7.16/public/index.html +0 -0
  69. package/{lib → bin}/templates/vue2.7.16/src/App.vue +0 -0
  70. package/{lib → bin}/templates/vue2.7.16/src/api/interface/index.js +0 -0
  71. package/{lib → bin}/templates/vue2.7.16/src/api/request.js +0 -0
  72. package/{lib → bin}/templates/vue2.7.16/src/api/server/index.js +0 -0
  73. package/{lib → bin}/templates/vue2.7.16/src/assets/logo.png +0 -0
  74. package/{lib → bin}/templates/vue2.7.16/src/components/README.md +0 -0
  75. package/{lib → bin}/templates/vue2.7.16/src/components/baseInfo/index.vue +0 -0
  76. package/{lib → bin}/templates/vue2.7.16/src/components/baseInfo/item.vue +0 -0
  77. package/{lib → bin}/templates/vue2.7.16/src/components/index.js +0 -0
  78. package/{lib → bin}/templates/vue2.7.16/src/components/layout/left-menu-and-top-info.vue +0 -0
  79. package/{lib → bin}/templates/vue2.7.16/src/components/pagination/index.vue +0 -0
  80. package/{lib → bin}/templates/vue2.7.16/src/css/coverage-style.css +0 -0
  81. package/{lib → bin}/templates/vue2.7.16/src/directive/index.js +0 -0
  82. package/{lib → bin}/templates/vue2.7.16/src/directive/input-number.js +0 -0
  83. package/{lib → bin}/templates/vue2.7.16/src/directive/permission.js +0 -0
  84. package/{lib → bin}/templates/vue2.7.16/src/directive/re-click.js +0 -0
  85. package/{lib → bin}/templates/vue2.7.16/src/global-config.js +0 -0
  86. package/{lib → bin}/templates/vue2.7.16/src/main.js +0 -0
  87. package/{lib → bin}/templates/vue2.7.16/src/prototype/README.md +0 -0
  88. package/{lib → bin}/templates/vue2.7.16/src/prototype/el-dialog.js +0 -0
  89. package/{lib → bin}/templates/vue2.7.16/src/prototype/index.js +0 -0
  90. package/{lib → bin}/templates/vue2.7.16/src/router/index.js +0 -0
  91. package/{lib → bin}/templates/vue2.7.16/src/store/index.js +0 -0
  92. package/{lib → bin}/templates/vue2.7.16/src/store/modules/dd.js +0 -0
  93. package/{lib → bin}/templates/vue2.7.16/src/store/modules/permissions.js +0 -0
  94. package/{lib → bin}/templates/vue2.7.16/src/views/404.vue +0 -0
  95. package/{lib → bin}/templates/vue2.7.16/src/views/Pitfalls//345/206/205/345/255/230/346/272/242/345/207/272//351/200/240/346/210/220vue2/345/206/205/345/255/230/346/272/242/345/207/272/347/232/204/345/257/271/350/261/241.js +0 -0
  96. package/{lib → bin}/templates/vue2.7.16/src/views/about.vue +0 -0
  97. package/{lib → bin}/templates/vue2.7.16/src/views/demo//345/205/250/345/261/200/345/274/271/347/252/227/ce.vue +0 -0
  98. package/{lib → bin}/templates/vue2.7.16/src/views/demo//345/205/250/345/261/200/345/274/271/347/252/227/index.vue +0 -0
  99. package/{lib → bin}/templates/vue2.7.16/src/views/home.vue +0 -0
  100. package/{lib → bin}/templates/vue2.7.16/src/views/template/base-info.vue +0 -0
  101. package/{lib → bin}/templates/vue2.7.16/src/views/template/list/ce.vue +0 -0
  102. package/{lib → bin}/templates/vue2.7.16/src/views/template/list/search.vue +0 -0
  103. package/{lib → bin}/templates/vue2.7.16/vue.config.js +0 -0
  104. package/{lib → bin}/templates/vue3.5.25-2025.12.4/.editorconfig +0 -0
  105. package/{lib → bin}/templates/vue3.5.25-2025.12.4/.gitattributes +0 -0
  106. package/{lib → bin}/templates/vue3.5.25-2025.12.4/.prettierrc.json +0 -0
  107. package/{lib → bin}/templates/vue3.5.25-2025.12.4/.vscode/extensions.json +0 -0
  108. package/{lib → bin}/templates/vue3.5.25-2025.12.4/index.html +0 -0
  109. package/{lib → bin}/templates/vue3.5.25-2025.12.4/public/favicon.svg +0 -0
  110. package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/App.vue +0 -0
  111. package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/assets/vue.svg +0 -0
  112. package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/boot/index.ts +2 -2
  113. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/boot/style.ts +0 -0
  114. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/css/coverage-style.css +0 -0
  115. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/directive/index.js +0 -0
  116. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/directive/rememberScrollPosition.ts +0 -0
  117. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/src/main.ts +0 -0
  118. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/tsconfig.json +0 -0
  119. /package/{lib → bin}/templates/vue3.5.25-2025.12.4/tsconfig.node.json +0 -0
  120. /package/{lib → bin}/templates/wx-miniapp//346/210/221/346/230/257wx-miniapp.txt" +0 -0
@@ -0,0 +1,31 @@
1
+ import type { App } from "vue"
2
+ import { createPinia } from "pinia"
3
+ import piniaPluginPersistedstate from "pinia-plugin-persistedstate"
4
+
5
+ /**
6
+ * 初始化pinia
7
+ * @param app vue上下文
8
+ */
9
+ export function setupPinia(app: App<Element>) {
10
+ const pinia = createPinia()
11
+
12
+ // 在每个 store 初始化时注入默认 persist 配置(使用 sessionStorage)
13
+ pinia.use((context) => {
14
+ const opts = context.options as any
15
+ const storeId = context.store?.$id ?? "unknown"
16
+ const defaultPersist = {
17
+ key: `pinia-${storeId}`,
18
+ storage: sessionStorage,
19
+ }
20
+ if (!opts.persist) {
21
+ opts.persist = defaultPersist
22
+ } else {
23
+ opts.persist = { ...defaultPersist, ...opts.persist }
24
+ }
25
+ })
26
+
27
+ // 挂载实际的持久化插件(不带参数以避免类型不匹配)
28
+ pinia.use(piniaPluginPersistedstate)
29
+
30
+ app.use(pinia)
31
+ }
@@ -1,10 +1,10 @@
1
1
  import type { App } from "vue"
2
- import router from "@/router/index"
2
+ import { createRouter } from "@/router/index"
3
3
 
4
4
  /**
5
5
  * 启动路由
6
6
  * @param app
7
7
  */
8
8
  export function setupRouter(app: App<Element>) {
9
- app.use(router)
9
+ app.use(createRouter())
10
10
  }
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div class="header c-underline c-box-shadow c-flex-cc">头部</div>
5
+ </template>
6
+
7
+ <style scope>
8
+ .header {
9
+ width: 100%;
10
+ height: 50px;
11
+ padding: 0 10px;
12
+ position: relative;
13
+ overflow: hidden;
14
+ justify-content: space-between;
15
+ }
16
+ </style>
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ import Header from "@/components/layout/header.vue"
3
+ import Menu from "@/components/layout/menu.vue"
4
+ import { useLayoutStore } from "@/stores"
5
+
6
+ const layoutStore = useLayoutStore()
7
+ </script>
8
+
9
+ <template>
10
+ <div class="c-layout c-flex-row">
11
+ <!-- <div>当前布局:{{ layoutStore.layout }}</div>
12
+ <div>内容是否全屏:{{ layoutStore.fullScreen }}</div> -->
13
+
14
+ <!-- 左侧:菜单 -->
15
+ <Menu></Menu>
16
+
17
+ <!-- 右侧:顶部和页面内容 -->
18
+ <div class="c-layout c-flex-1">
19
+ <Header></Header>
20
+ <div
21
+ class="content c-flex-1 c-overflow-hidden"
22
+ :style="{ padding: $route.meta.needPadding === false ? '' : '10px' }"
23
+ >
24
+ <slot />
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </template>
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div class="menu c-box-shadow c-rightLine">菜单</div>
5
+ </template>
6
+
7
+ <style scope>
8
+ .menu {
9
+ width: 240px;
10
+ height: 100%;
11
+ }
12
+ </style>
@@ -0,0 +1,5 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div>404页面</div>
5
+ </template>
@@ -0,0 +1,7 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div>
5
+ <div class="about">关于页</div>
6
+ </div>
7
+ </template>
@@ -0,0 +1,70 @@
1
+ <script setup lang="ts">
2
+ const temp = ref("111")
3
+ </script>
4
+
5
+ <template>
6
+ <div class="c-layout">
7
+ <div>主页: temp:{{ temp }}</div>
8
+ <div class="c-mb-20">
9
+ <el-button type="primary">Primary</el-button>
10
+ <el-input v-model="temp"></el-input>
11
+ </div>
12
+ <div class="c-flex-1 c-overflow-auto">
13
+ <div>11</div>
14
+ <div>11</div>
15
+ <div>11</div>
16
+ <div>11</div>
17
+ <div>11</div>
18
+ <div>11</div>
19
+ <div>11</div>
20
+ <div>11</div>
21
+ <div>11</div>
22
+ <div>11</div>
23
+ <div>11</div>
24
+ <div>11</div>
25
+ <div>11</div>
26
+ <div>11</div>
27
+ <div>11</div>
28
+ <div>11</div>
29
+ <div>11</div>
30
+ <div>11</div>
31
+ <div>11</div>
32
+ <div>11</div>
33
+ <div>11</div>
34
+ <div>11</div>
35
+ <div>11</div>
36
+ <div>11</div>
37
+ <div>11</div>
38
+ <div>11</div>
39
+ <div>11</div>
40
+ <div>11</div>
41
+ <div>11</div>
42
+ <div>11</div>
43
+ <div>11</div>
44
+ <div>11</div>
45
+ <div>11</div>
46
+ <div>11</div>
47
+ <div>11</div>
48
+ <div>11</div>
49
+ <div>11</div>
50
+ <div>11</div>
51
+ <div>11</div>
52
+ <div>11</div>
53
+ <div>11</div>
54
+ <div>11</div>
55
+ <div>11</div>
56
+ <div>11</div>
57
+ <div>11</div>
58
+ <div>11</div>
59
+ <div>11</div>
60
+ <div>11</div>
61
+ <div>11</div>
62
+ <div>11</div>
63
+ <div>11</div>
64
+ <div>11</div>
65
+ <div>11</div>
66
+ <div>11</div>
67
+ <div>11</div>
68
+ </div>
69
+ </div>
70
+ </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ import leftRightLayout from "@/components/layout/left-right.vue"
3
+ </script>
4
+
5
+ <template>
6
+ <left-right-layout>
7
+ <router-view v-slot="{ Component }">
8
+ <transition name="el-fade-in-linear" mode="out-in">
9
+ <component :is="Component" />
10
+ </transition>
11
+ </router-view>
12
+ </left-right-layout>
13
+ </template>
@@ -0,0 +1,76 @@
1
+ <script setup lang="ts">
2
+ import { useAccountStore, useDDStore } from "@/stores"
3
+ const router = useRouter()
4
+
5
+ const accountStore = useAccountStore()
6
+ const ddStore = useDDStore()
7
+ function printAccountStore() {
8
+ console.log("认证仓库=====>", accountStore)
9
+ }
10
+ </script>
11
+
12
+ <template>
13
+ <div class="c-card-layout" style="padding: 50px">
14
+ <el-card class="c-w-full">
15
+ <template v-slot:header>
16
+ <div class="clearfix">
17
+ <span>是否需要登录</span>
18
+ <el-button class="c-right" size="small" type="primary" @click="accountStore.changeNeedLogin()">
19
+ 改变是否需要登录
20
+ </el-button>
21
+ </div>
22
+ </template>
23
+ <div>
24
+ {{ accountStore.needLogin }}
25
+ </div>
26
+ </el-card>
27
+
28
+ <el-card class="c-w-full">
29
+ <template v-slot:header>
30
+ <div class="clearfix">
31
+ <span>当前登录信息</span>
32
+ <div class="c-right">
33
+ <el-button size="small" type="primary" @click="accountStore.login()"> 登录 </el-button>
34
+ <el-button size="small" type="danger" @click="accountStore.logout()"> 退出登录 </el-button>
35
+ </div>
36
+ </div>
37
+ </template>
38
+ <div>
39
+ <h3 class="c-mb-10">用户名称:{{ accountStore.userInfo?.name }}</h3>
40
+ <h3 class="c-mb-10">token:{{ accountStore.token }}</h3>
41
+ </div>
42
+ </el-card>
43
+
44
+ <el-card class="c-w-full">
45
+ <div style="text-align: right">
46
+ <el-button type="primary" size="small" @click="printAccountStore()"> 打印认证仓库 </el-button>
47
+ </div>
48
+ </el-card>
49
+
50
+ <el-card class="c-w-full">
51
+ <div style="text-align: right">
52
+ <el-button
53
+ type="primary"
54
+ size="small"
55
+ :disabled="accountStore.needLogin && !accountStore.token"
56
+ @click="router.push('/')"
57
+ >
58
+ 跳转首页
59
+ </el-button>
60
+ </div>
61
+ </el-card>
62
+
63
+ <el-card class="c-w-full">
64
+ <template v-slot:header>
65
+ <div class="clearfix">
66
+ <span>数据字典</span>
67
+ <el-button class="c-right" size="small" type="primary" @click="ddStore.getDD()"> 获取数据字典 </el-button>
68
+ </div>
69
+ </template>
70
+ <div>
71
+ <h3 class="c-mb-10">sex: {{ ddStore.sex }}</h3>
72
+ <h3 class="c-mb-10">city: {{ ddStore.citys }}</h3>
73
+ </div>
74
+ </el-card>
75
+ </div>
76
+ </template>
@@ -0,0 +1,28 @@
1
+ import { createRouter as _createRouter, createWebHashHistory } from "vue-router"
2
+ import { routes } from "vue-router/auto-routes"
3
+ import { useAccountStore } from "@/stores"
4
+
5
+ /** 创建路由并挂载钩子 */
6
+ export function createRouter() {
7
+ const accountStore = useAccountStore()
8
+ // 创建路由实例
9
+ const router = _createRouter({
10
+ history: createWebHashHistory(import.meta.env.BASE_URL),
11
+ routes: [...routes],
12
+ })
13
+
14
+ // 全局路由守卫
15
+ router.beforeEach((to, from, next) => {
16
+ // 需要登录 并且 登录状态为false 并且 不是登录页面
17
+ if (accountStore.needLogin && !accountStore.token && to.name !== "/login") {
18
+ if (from.name !== "/login") {
19
+ router.push({ name: "/login" })
20
+ }
21
+ next(false)
22
+ return
23
+ }
24
+ next()
25
+ })
26
+
27
+ return router
28
+ }
@@ -0,0 +1,49 @@
1
+ interface UserInfo {
2
+ /** 用户名 */
3
+ name: string
4
+ /** token */
5
+ token: string
6
+ }
7
+
8
+ interface State {
9
+ /** 是否需要登录 */
10
+ needLogin: boolean
11
+ /** 用户名 */
12
+ userInfo?: UserInfo
13
+ }
14
+
15
+ /**
16
+ * 认证数据
17
+ */
18
+ export const useAccountStore = defineStore("account", {
19
+ state: (): State => ({
20
+ needLogin: false,
21
+ userInfo: undefined,
22
+ }),
23
+ getters: {
24
+ /** token */
25
+ token(): string {
26
+ return this.userInfo?.token || ""
27
+ },
28
+ },
29
+ actions: {
30
+ /** 改变是否需要登录 */
31
+ changeNeedLogin() {
32
+ this.needLogin = !this.needLogin
33
+ },
34
+ /** 登录 */
35
+ login() {
36
+ this.userInfo = {
37
+ name: "李某铷",
38
+ token: "我是token-xxxx",
39
+ }
40
+ },
41
+ /** 退出登录 */
42
+ logout() {
43
+ this.userInfo = undefined
44
+ },
45
+ },
46
+ persist: {
47
+ storage: localStorage, // 存储方式(默认localStorage,可选sessionStorage)
48
+ },
49
+ })
@@ -0,0 +1,35 @@
1
+ interface DD {
2
+ /** 标签 */
3
+ label: string
4
+ /** 值 */
5
+ value: string | number
6
+ }
7
+
8
+ interface State {
9
+ /** 性别 */
10
+ sex: DD[]
11
+ /** 城市 */
12
+ citys?: DD[]
13
+ }
14
+
15
+ /**
16
+ * 数据字典
17
+ */
18
+ export const useDDStore = defineStore("dd", {
19
+ state: (): State => ({ sex: [], citys: [] }),
20
+ actions: {
21
+ getDD() {
22
+ this.citys = [
23
+ { label: "北京", value: "1" },
24
+ { label: "上海", value: "2" },
25
+ { label: "广州", value: "3" },
26
+ { label: "深圳", value: "4" },
27
+ { label: "厦门", value: "5" },
28
+ ]
29
+ this.sex = [
30
+ { label: "男", value: "1" },
31
+ { label: "女", value: "0" },
32
+ ]
33
+ },
34
+ },
35
+ })
@@ -0,0 +1,3 @@
1
+ export * from "./account"
2
+ export * from "./dd"
3
+ export * from "./layout"
@@ -0,0 +1,22 @@
1
+ interface State {
2
+ /** 布局 */
3
+ layout: "top-bottom" | "left-right"
4
+ /** 是否全屏 */
5
+ fullScreen?: boolean
6
+ /** 是否显示菜单 */
7
+ showMenu: boolean
8
+ }
9
+
10
+ /**
11
+ * 认证数据
12
+ */
13
+ export const useLayoutStore = defineStore("layout", {
14
+ state: (): State => ({
15
+ layout: "left-right",
16
+ fullScreen: false,
17
+ showMenu: true,
18
+ }),
19
+ persist: {
20
+ storage: localStorage,
21
+ },
22
+ })
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 认证数据,组合式API写法,不管是选项式API写法还是组合式API写法,同一个项目里,最好是同一种写法,此项目统一采用选项式API写法
3
+ */
4
+ export const useAccountStore = defineStore(
5
+ "pinia-account",
6
+ () => {
7
+ /** 是否需要登录 */
8
+ const needLogin = ref(false)
9
+ /** 改变是否需要登录 */
10
+ const changeNeedLogin = () => {
11
+ needLogin.value = !needLogin.value
12
+ }
13
+
14
+ /** 登录状态 */
15
+ const loginStatus = ref(false)
16
+ /** 改变登录状态 */
17
+ const changeLoginStatus = () => {
18
+ loginStatus.value = !loginStatus.value
19
+ }
20
+
21
+ return { needLogin, changeNeedLogin, loginStatus, changeLoginStatus }
22
+ },
23
+ {
24
+ persist: {
25
+ storage: localStorage,
26
+ },
27
+ },
28
+ )
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "components.d.ts", "auto-imports.d.ts"],
3
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "components.d.ts", "auto-imports.d.ts", "typed-router.d.ts"],
4
4
  "exclude": ["src/**/__tests__/*"],
5
5
  "compilerOptions": {
6
6
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
@@ -0,0 +1,119 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection ES6UnusedImports
5
+ // Generated by unplugin-vue-router. !! DO NOT MODIFY THIS FILE !!
6
+ // It's recommended to commit this file.
7
+ // Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
8
+
9
+ declare module 'vue-router/auto-resolver' {
10
+ export type ParamParserCustom = never
11
+ }
12
+
13
+ declare module 'vue-router/auto-routes' {
14
+ import type {
15
+ RouteRecordInfo,
16
+ ParamValue,
17
+ ParamValueOneOrMore,
18
+ ParamValueZeroOrMore,
19
+ ParamValueZeroOrOne,
20
+ } from 'vue-router'
21
+
22
+ /**
23
+ * Route name map generated by unplugin-vue-router
24
+ */
25
+ export interface RouteNamedMap {
26
+ '/': RouteRecordInfo<
27
+ '/',
28
+ '/',
29
+ Record<never, never>,
30
+ Record<never, never>,
31
+ | '//'
32
+ | '//about'
33
+ >,
34
+ '//': RouteRecordInfo<
35
+ '//',
36
+ '/',
37
+ Record<never, never>,
38
+ Record<never, never>,
39
+ | never
40
+ >,
41
+ '//about': RouteRecordInfo<
42
+ '//about',
43
+ '/about',
44
+ Record<never, never>,
45
+ Record<never, never>,
46
+ | never
47
+ >,
48
+ '/[...404]': RouteRecordInfo<
49
+ '/[...404]',
50
+ '/:404(.*)',
51
+ { 404: ParamValue<true> },
52
+ { 404: ParamValue<false> },
53
+ | never
54
+ >,
55
+ '/login': RouteRecordInfo<
56
+ '/login',
57
+ '/login',
58
+ Record<never, never>,
59
+ Record<never, never>,
60
+ | never
61
+ >,
62
+ }
63
+
64
+ /**
65
+ * Route file to route info map by unplugin-vue-router.
66
+ * Used by the \`sfc-typed-router\` Volar plugin to automatically type \`useRoute()\`.
67
+ *
68
+ * Each key is a file path relative to the project root with 2 properties:
69
+ * - routes: union of route names of the possible routes when in this page (passed to useRoute<...>())
70
+ * - views: names of nested views (can be passed to <RouterView name="...">)
71
+ *
72
+ * @internal
73
+ */
74
+ export interface _RouteFileInfoMap {
75
+ 'src/pages/index.vue': {
76
+ routes:
77
+ | '/'
78
+ | '//'
79
+ | '//about'
80
+ views:
81
+ | 'default'
82
+ }
83
+ 'src/pages/index/index.vue': {
84
+ routes:
85
+ | '//'
86
+ views:
87
+ | never
88
+ }
89
+ 'src/pages/index/about.vue': {
90
+ routes:
91
+ | '//about'
92
+ views:
93
+ | never
94
+ }
95
+ 'src/pages/[...404].vue': {
96
+ routes:
97
+ | '/[...404]'
98
+ views:
99
+ | never
100
+ }
101
+ 'src/pages/login.vue': {
102
+ routes:
103
+ | '/login'
104
+ views:
105
+ | never
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Get a union of possible route names in a certain route component file.
111
+ * Used by the \`sfc-typed-router\` Volar plugin to automatically type \`useRoute()\`.
112
+ *
113
+ * @internal
114
+ */
115
+ export type _RouteNamesForFilePath<FilePath extends string> =
116
+ _RouteFileInfoMap extends Record<FilePath, infer Info>
117
+ ? Info['routes']
118
+ : keyof RouteNamedMap
119
+ }
@@ -7,16 +7,18 @@ import vueDevTools from "vite-plugin-vue-devtools"
7
7
  import ViteAutoImport from "unplugin-auto-import/vite"
8
8
  import Components from "unplugin-vue-components/vite"
9
9
  import { ElementPlusResolver } from "unplugin-vue-components/resolvers"
10
+ import VueRouter from "unplugin-vue-router/vite"
10
11
 
11
12
  // https://vite.dev/config/
12
13
  export default defineConfig({
13
14
  base: "./", // 公共路径
14
15
  plugins: [
16
+ VueRouter(), // 必须在 vue() 之前
15
17
  vue(),
16
18
  vueJsx(),
17
19
  vueDevTools(),
18
20
  ViteAutoImport({
19
- imports: ["vue", "vue-router"],
21
+ imports: ["vue", "vue-router", "pinia"],
20
22
  resolvers: [ElementPlusResolver()],
21
23
  }),
22
24
  Components({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ljr-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -9,10 +9,10 @@
9
9
  "node": "^20.19.0 || >=22.12.0"
10
10
  },
11
11
  "bin": {
12
- "ljr": "lib/index.js",
13
- "ljr-cli": "lib/index.js",
14
- "ljr-demo1": "lib/demo1.js",
15
- "ljr-demo2": "lib/demo2.js"
12
+ "ljr": "bin/index.js",
13
+ "ljr-cli": "bin/index.js",
14
+ "ljr-demo1": "bin/demo1.js",
15
+ "ljr-demo2": "bin/demo2.js"
16
16
  },
17
17
  "scripts": {
18
18
  "发布": "npm publish"
@@ -26,7 +26,8 @@
26
26
  "download-git-repo": "^3.0.2",
27
27
  "fs-extra": "^11.3.3",
28
28
  "gradient-string": "^3.0.0",
29
- "l-global": "^1.0.2",
30
- "replace-in-file": "^8.4.0"
29
+ "l-global": "^1.0.5",
30
+ "replace-in-file": "^8.4.0",
31
+ "update-notifier": "^7.3.1"
31
32
  }
32
33
  }