create-jnrs-template-vue 1.2.1 → 1.2.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 (69) hide show
  1. package/bin/create.mjs +3 -3
  2. package/jnrs-template-vue/auto-imports.d.ts +4 -0
  3. package/jnrs-template-vue/components.d.ts +0 -1
  4. package/jnrs-template-vue/package.json +3 -4
  5. package/jnrs-template-vue/public/system/menu.json +1 -1
  6. package/jnrs-template-vue/src/App.vue +1 -3
  7. package/jnrs-template-vue/src/api/common/index.ts +2 -2
  8. package/jnrs-template-vue/src/api/demos/index.ts +84 -48
  9. package/jnrs-template-vue/src/api/system/index.ts +10 -10
  10. package/jnrs-template-vue/src/api/user/index.ts +2 -2
  11. package/jnrs-template-vue/src/assets/styles/animation.scss +0 -0
  12. package/jnrs-template-vue/src/assets/styles/common.scss +4 -0
  13. package/jnrs-template-vue/src/assets/styles/fonts.scss +4 -1
  14. package/jnrs-template-vue/src/assets/styles/{main.scss → index.scss} +1 -0
  15. package/jnrs-template-vue/src/assets/styles/init.scss +4 -13
  16. package/jnrs-template-vue/src/assets/styles/root.scss +0 -3
  17. package/jnrs-template-vue/src/components/common/{JnDictTag.vue → DictTag.vue} +1 -1
  18. package/jnrs-template-vue/src/components/{base → common}/PdfView.vue +2 -2
  19. package/jnrs-template-vue/src/components/select/SelectManager.vue +20 -0
  20. package/jnrs-template-vue/src/composables/common/usePagination.ts +4 -4
  21. package/jnrs-template-vue/src/composables/common/useTable.ts +4 -4
  22. package/jnrs-template-vue/src/composables/tools/useMouseSelection.ts +150 -0
  23. package/jnrs-template-vue/src/layout/SideMenu.vue +1 -0
  24. package/jnrs-template-vue/src/layout/TopHeader.vue +1 -1
  25. package/jnrs-template-vue/src/locales/en.ts +1 -1
  26. package/jnrs-template-vue/src/locales/index.ts +1 -1
  27. package/jnrs-template-vue/src/main.ts +1 -1
  28. package/jnrs-template-vue/src/types/index.ts +45 -3
  29. package/jnrs-template-vue/src/views/demos/crud/index.vue +140 -40
  30. package/jnrs-template-vue/src/views/demos/unitTest/RequestPage.vue +1 -1
  31. package/jnrs-template-vue/src/views/demos/unitTest/index.vue +26 -2
  32. package/jnrs-template-vue/src/views/login/index.vue +7 -2
  33. package/jnrs-template-vue/src/views/system/dict/index.vue +2 -2
  34. package/jnrs-template-vue/src/views/system/menu/index.vue +2 -2
  35. package/jnrs-template-vue/src/views/system/mine/baseInfo.vue +1 -1
  36. package/jnrs-template-vue/tsconfig.json +1 -9
  37. package/jnrs-template-vue/vite.config.ts +1 -3
  38. package/jnrs-template-vue/viteMockServe/fail.ts +12 -0
  39. package/jnrs-template-vue/viteMockServe/file.ts +2 -3
  40. package/jnrs-template-vue/viteMockServe/json/tableRes.json +384 -342
  41. package/package.json +1 -1
  42. package/jnrs-template-vue/src/assets/images/fileIcon/iconArchive.png +0 -0
  43. package/jnrs-template-vue/src/assets/images/fileIcon/iconAudio.png +0 -0
  44. package/jnrs-template-vue/src/assets/images/fileIcon/iconCode.png +0 -0
  45. package/jnrs-template-vue/src/assets/images/fileIcon/iconExcel.png +0 -0
  46. package/jnrs-template-vue/src/assets/images/fileIcon/iconFile.png +0 -0
  47. package/jnrs-template-vue/src/assets/images/fileIcon/iconFlash.png +0 -0
  48. package/jnrs-template-vue/src/assets/images/fileIcon/iconGif.png +0 -0
  49. package/jnrs-template-vue/src/assets/images/fileIcon/iconImage.png +0 -0
  50. package/jnrs-template-vue/src/assets/images/fileIcon/iconMac.png +0 -0
  51. package/jnrs-template-vue/src/assets/images/fileIcon/iconOfd.png +0 -0
  52. package/jnrs-template-vue/src/assets/images/fileIcon/iconPdf.png +0 -0
  53. package/jnrs-template-vue/src/assets/images/fileIcon/iconPpt.png +0 -0
  54. package/jnrs-template-vue/src/assets/images/fileIcon/iconText.png +0 -0
  55. package/jnrs-template-vue/src/assets/images/fileIcon/iconUnknown.png +0 -0
  56. package/jnrs-template-vue/src/assets/images/fileIcon/iconVideo.png +0 -0
  57. package/jnrs-template-vue/src/assets/images/fileIcon/iconWindows.png +0 -0
  58. package/jnrs-template-vue/src/assets/images/fileIcon/iconWord.png +0 -0
  59. package/jnrs-template-vue/src/assets/images/fileIcon/iconWps.png +0 -0
  60. package/jnrs-template-vue/src/components/base/JnFileUpload.vue +0 -433
  61. package/jnrs-template-vue/src/components/common/JnDatetime.vue +0 -37
  62. package/jnrs-template-vue/src/components/common/JnEdit.vue +0 -68
  63. package/jnrs-template-vue/src/components/common/JnPagination.vue +0 -83
  64. package/jnrs-template-vue/src/components/common/JnTable.vue +0 -133
  65. package/jnrs-template-vue/src/composables/tools/useReactivityTableHeight.ts +0 -63
  66. /package/jnrs-template-vue/src/components/{base → common}/ImageView.vue +0 -0
  67. /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-pdf.pdf +0 -0
  68. /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-png-0.png +0 -0
  69. /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-png-1.png +0 -0
package/bin/create.mjs CHANGED
@@ -38,7 +38,7 @@ function getInstallCommand(packageManager) {
38
38
  }
39
39
 
40
40
  function getRunCommand(packageManager, script) {
41
- if (!packageManager || packageManager === 'skip') return `npm run ${script}` // fallback for skip
41
+ if (!packageManager || packageManager === 'skip') return `pnpm ${script}` // fallback for skip
42
42
  switch (packageManager) {
43
43
  case 'pnpm':
44
44
  return `pnpm ${script}`
@@ -125,7 +125,7 @@ async function main() {
125
125
 
126
126
  if (!selected) process.exit(1)
127
127
 
128
- let packageManager = 'npm' // 默认用于生成 dev 命令
128
+ let packageManager = 'pnpm' // 默认用于生成 dev 命令
129
129
  if (selected !== 'skip') {
130
130
  packageManager = selected
131
131
  console.log(`\n📦 使用 ${packageManager} 安装依赖项中...\n`)
@@ -153,7 +153,7 @@ async function main() {
153
153
  if (selected === 'skip') {
154
154
  const fallbackPM = availablePMs[0] || 'npm'
155
155
  const [cmd, ...args] = getInstallCommand(fallbackPM)
156
- console.log(` #👉 手动安装依赖:`)
156
+ console.log(`\n👉 手动安装依赖:`)
157
157
  console.log(` ${cmd} ${args.join(' ')}`)
158
158
  }
159
159
  console.log(` ${devCmd}\n`)
@@ -7,7 +7,11 @@
7
7
  export {}
8
8
  declare global {
9
9
  const ElButton: typeof import('element-plus/es').ElButton
10
+ const ElCheckbox: typeof import('element-plus/es').ElCheckbox
10
11
  const ElMessage: typeof import('element-plus/es').ElMessage
11
12
  const ElMessageBox: typeof import('element-plus/es').ElMessageBox
13
+ const ElOption: typeof import('element-plus/es').ElOption
12
14
  const ElSwitch: typeof import('element-plus/es').ElSwitch
15
+ const ElTableColumn: typeof import('element-plus/es').ElTableColumn
16
+ const vLoading: typeof import('element-plus/es').ElLoadingDirective
13
17
  }
@@ -33,7 +33,6 @@ declare module 'vue' {
33
33
  ElMenu: typeof import('element-plus/es')['ElMenu']
34
34
  ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
35
35
  ElOption: typeof import('element-plus/es')['ElOption']
36
- ElPagination: typeof import('element-plus/es')['ElPagination']
37
36
  ElPopover: typeof import('element-plus/es')['ElPopover']
38
37
  ElSelect: typeof import('element-plus/es')['ElSelect']
39
38
  ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jnrs-template-vue",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "JNRS 信息化管理系统模板",
5
5
  "author": "Talia-Tan",
6
6
  "private": true,
@@ -19,9 +19,8 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@element-plus/icons-vue": "^2.3.2",
22
- "@jnrs/core": "1.1.7",
23
- "@jnrs/shared": "1.1.7",
24
- "@jnrs/vue-core": "1.2.1",
22
+ "@jnrs/shared": "1.1.8",
23
+ "@jnrs/vue-core": "1.2.3",
25
24
  "@vueuse/core": "^14.1.0",
26
25
  "element-plus": "^2.11.9",
27
26
  "pinia": "^3.0.4",
@@ -15,7 +15,7 @@
15
15
  "path": "/unitTest",
16
16
  "name": "UnitTest",
17
17
  "meta": {
18
- "title": "测试页面",
18
+ "title": "功能测试页面",
19
19
  "todoCount": 8
20
20
  },
21
21
  "component": "/demos/unitTest/index"
@@ -6,7 +6,6 @@ import zhCn from 'element-plus/es/locale/lang/zh-CN'
6
6
  import en from 'element-plus/es/locale/lang/en'
7
7
  import { useI18n } from 'vue-i18n'
8
8
  import { changeLocales as changeLocalesForShared } from '@jnrs/shared/locales'
9
- import { changeLocales as changeLocalesForCore } from '@jnrs/core/locales'
10
9
 
11
10
  const { locale } = useI18n()
12
11
 
@@ -16,7 +15,6 @@ watch(
16
15
  (newValue) => {
17
16
  locale.value = newValue
18
17
  changeLocalesForShared(newValue)
19
- changeLocalesForCore(newValue)
20
18
  },
21
19
  {
22
20
  immediate: true
@@ -30,7 +28,7 @@ const localeMap = {
30
28
 
31
29
  onMounted(() => {
32
30
  console.log(
33
- '%cPowered by 🅹🅽🆁🆂 TECH',
31
+ '%cPOWERED BY 🅹🅽🆁🆂 TECH',
34
32
  `background: #f2f2c1;
35
33
  color: #d15f2c;
36
34
  font-weight: bold;
@@ -1,4 +1,4 @@
1
- import { request } from '@jnrs/vue-core'
1
+ import { axiosRequest } from '@jnrs/vue-core/request'
2
2
 
3
3
  /**
4
4
  * axios 方式下载文件
@@ -6,7 +6,7 @@ import { request } from '@jnrs/vue-core'
6
6
  * @returns Blob
7
7
  */
8
8
  export const FileApi = (uniqueFileName: string): Promise<Blob> => {
9
- return request({
9
+ return axiosRequest({
10
10
  url: '/api/files/' + uniqueFileName,
11
11
  method: 'get',
12
12
  responseType: 'blob',
@@ -1,47 +1,10 @@
1
- import type { Document } from '@/types'
2
- import { request } from '@jnrs/vue-core'
1
+ import type { Pagination, PageTableData, FileContainer } from '@/types'
2
+ import { axiosRequest } from '@jnrs/vue-core/request'
3
3
 
4
4
  /**
5
- * 404 错误
5
+ * 项目
6
6
  */
7
- export const NotFoundApi = () => {
8
- return request({
9
- url: '/notFound',
10
- method: 'get'
11
- })
12
- }
13
-
14
- /**
15
- * 无权限
16
- * @param showErrorMsg 是否显示错误信息
17
- */
18
- export const NoAuth = (showErrorMsg: boolean) => {
19
- return request({
20
- url: '/auth/no',
21
- method: 'post',
22
- showErrorMsg
23
- })
24
- }
25
-
26
- interface DetailsParams {
27
- attachmentDocument: Document
28
- imageDocument: Document
29
- }
30
-
31
- /**
32
- * 数据详情
33
- */
34
- export const DetailsApi = (): Promise<DetailsParams> => {
35
- return request({
36
- url: '/details',
37
- method: 'get'
38
- })
39
- }
40
-
41
- /**
42
- * 项目项
43
- */
44
- export interface ProjectItem {
7
+ export interface ProjectItem extends FileContainer {
45
8
  id: string
46
9
  programCode: string
47
10
  program: string
@@ -55,12 +18,10 @@ export interface ProjectItem {
55
18
  plannedFinishDate: string
56
19
  progress: string
57
20
  status: '进行中' | '已完成' | '未开始' | '已暂停'
58
- imageDocument?: Document // 图片类附件
59
- attachmentDocument?: Document // 普通文件类附件
60
21
  }
61
22
 
62
23
  /**
63
- * 新增项目项
24
+ * 新增
64
25
  */
65
26
  type AddProjectOmitKeys =
66
27
  | 'id'
@@ -75,15 +36,57 @@ type AddProjectOmitKeys =
75
36
 
76
37
  export type AddProjectItem = Omit<ProjectItem, AddProjectOmitKeys> & {
77
38
  id?: string
39
+ managerId?: Record<string, unknown>
78
40
  newAttachmentFile: []
79
41
  newImageFiles: []
80
42
  }
81
43
 
44
+ /**
45
+ * 查询
46
+ */
47
+ export interface ProjectQuery extends Pagination {
48
+ code?: string
49
+ projectType?: '敏捷型' | '瀑布型' | '混合型'
50
+ manager?: string
51
+ }
52
+
53
+ /**
54
+ * 测试 404 错误
55
+ */
56
+ export const NotFoundApi = () => {
57
+ return axiosRequest({
58
+ url: '/mock/notFound',
59
+ method: 'get'
60
+ })
61
+ }
62
+
63
+ /**
64
+ * 测试 无权限
65
+ * @param showErrorMsg 是否显示错误信息
66
+ */
67
+ export const NoAuth = (showErrorMsg: boolean) => {
68
+ return axiosRequest({
69
+ url: '/mock/auth/no',
70
+ method: 'post',
71
+ showErrorMsg
72
+ })
73
+ }
74
+
75
+ /**
76
+ * 数据详情
77
+ */
78
+ export const DetailsApi = (): Promise<FileContainer> => {
79
+ return axiosRequest({
80
+ url: '/mock/details',
81
+ method: 'get'
82
+ })
83
+ }
84
+
82
85
  /**
83
86
  * 表单新增
84
87
  */
85
88
  export const DemosFormApi = (data: FormData) => {
86
- return request({
89
+ return axiosRequest({
87
90
  url: '/mock/demos/save',
88
91
  method: 'post',
89
92
  data
@@ -93,9 +96,42 @@ export const DemosFormApi = (data: FormData) => {
93
96
  /**
94
97
  * 数据详情
95
98
  */
96
- export const DemosTableApi = (): Promise<ProjectItem[]> => {
97
- return request({
99
+ export const DemosTableApi = (query: ProjectQuery): Promise<PageTableData<ProjectItem>> => {
100
+ return axiosRequest({
98
101
  url: '/mock/demos/table',
99
- method: 'get'
102
+ method: 'get',
103
+ data: query
104
+ })
105
+ }
106
+
107
+ /**
108
+ * 下载数据导入模板
109
+ */
110
+ export const DemosImportTemplateApi = (): Promise<Blob> => {
111
+ return axiosRequest({
112
+ url: '/mock/project/template',
113
+ method: 'post'
114
+ })
115
+ }
116
+
117
+ /**
118
+ * 项目数据导入
119
+ */
120
+ export const DemosImportDataApi = (data: FormData) => {
121
+ return axiosRequest({
122
+ url: '/mock/project/import',
123
+ method: 'post',
124
+ data
125
+ })
126
+ }
127
+
128
+ /**
129
+ * 项目数据导出
130
+ */
131
+ export const DemosExportApi = (data: Record<string, unknown>): Promise<Blob> => {
132
+ return axiosRequest({
133
+ url: '/mock/project/export',
134
+ method: 'post',
135
+ data
100
136
  })
101
137
  }
@@ -1,10 +1,10 @@
1
- import { request } from '@jnrs/vue-core'
1
+ import { axiosRequest } from '@jnrs/vue-core/request'
2
2
  import type { Dict, DictItem, User, Role } from '@jnrs/shared'
3
3
  import type { MenuItem } from '@jnrs/vue-core'
4
4
 
5
5
  // 菜单
6
6
  export const MenuApi = (): Promise<MenuItem[]> => {
7
- return request({
7
+ return axiosRequest({
8
8
  url: '/system/menu.json', // /public 文件夹下
9
9
  mockUrl: '/mock/menu',
10
10
  method: 'get'
@@ -23,7 +23,7 @@ export interface LoginResult extends User {
23
23
  }
24
24
 
25
25
  export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
26
- return request({
26
+ return axiosRequest({
27
27
  url: '/api/auth/login',
28
28
  method: 'post',
29
29
  data,
@@ -33,7 +33,7 @@ export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
33
33
 
34
34
  // 退出登录
35
35
  export const LogoutApi = () => {
36
- return request({
36
+ return axiosRequest({
37
37
  url: '/api/auth/logout',
38
38
  method: 'get'
39
39
  })
@@ -41,7 +41,7 @@ export const LogoutApi = () => {
41
41
 
42
42
  // 获取用户信息
43
43
  export const UserInfoApi = (): Promise<User> => {
44
- return request({
44
+ return axiosRequest({
45
45
  url: '/api/auth/user-info',
46
46
  method: 'get'
47
47
  })
@@ -54,7 +54,7 @@ interface PasswordChange {
54
54
  }
55
55
 
56
56
  export const PasswordChangeApi = (data: PasswordChange) => {
57
- return request({
57
+ return axiosRequest({
58
58
  url: '/api/auth/change-password',
59
59
  method: 'post',
60
60
  data
@@ -63,7 +63,7 @@ export const PasswordChangeApi = (data: PasswordChange) => {
63
63
 
64
64
  // 获取字典列表
65
65
  export const DictApi = (): Promise<DictItem[]> => {
66
- return request({
66
+ return axiosRequest({
67
67
  url: '/api/dict-manager',
68
68
  method: 'get'
69
69
  })
@@ -71,7 +71,7 @@ export const DictApi = (): Promise<DictItem[]> => {
71
71
 
72
72
  // 获取单个字典
73
73
  export const DictDetailApi = (id: string) => {
74
- return request({
74
+ return axiosRequest({
75
75
  url: `/api/dict-manager/detail/${id}`,
76
76
  method: 'get'
77
77
  })
@@ -79,7 +79,7 @@ export const DictDetailApi = (id: string) => {
79
79
 
80
80
  // 修改单个字典
81
81
  export const DictChangeApi = (data: DictItem) => {
82
- return request({
82
+ return axiosRequest({
83
83
  url: '/api/dict-manager/detail',
84
84
  method: 'post',
85
85
  data
@@ -88,7 +88,7 @@ export const DictChangeApi = (data: DictItem) => {
88
88
 
89
89
  // 获取角色列表
90
90
  export const RoleApi = (): Promise<Role[]> => {
91
- return request({
91
+ return axiosRequest({
92
92
  url: '/api/role-manager',
93
93
  method: 'get',
94
94
  noAuth: true
@@ -1,8 +1,8 @@
1
- import { request } from '@jnrs/vue-core'
1
+ import { axiosRequest } from '@jnrs/vue-core/request'
2
2
 
3
3
  // 获取用户信息
4
4
  export const UserApi = (id: string) => {
5
- return request({
5
+ return axiosRequest({
6
6
  url: '/api/user',
7
7
  method: 'get',
8
8
  params: {
@@ -1,3 +1,7 @@
1
+ /*
2
+ * 业务功能通用样式表
3
+ */
4
+
1
5
  .topBarBtn {
2
6
  position: relative;
3
7
  margin: 0 8px;
@@ -1,4 +1,7 @@
1
- /* font */
1
+ /*
2
+ * 字体样式表
3
+ */
4
+
2
5
  @font-face {
3
6
  font-family: 'Alibaba-PuHuiTi-Regular';
4
7
  src: url('@/assets/fonts/AlibabaPuHuiTi-Regular.woff2');
@@ -2,6 +2,7 @@
2
2
  @use './fonts.scss';
3
3
  @use './root.scss';
4
4
  @use './common.scss';
5
+ @use './animation.scss';
5
6
 
6
7
  body {
7
8
  width: 100vw;
@@ -1,3 +1,7 @@
1
+ /*
2
+ * 初始化重置样式表
3
+ */
4
+
1
5
  *,
2
6
  *::before,
3
7
  *::after {
@@ -10,19 +14,6 @@ a {
10
14
  text-decoration: none;
11
15
  }
12
16
 
13
- /* 所有自动填充 input */
14
- input:-webkit-autofill,
15
- input:-webkit-autofill:hover,
16
- input:-webkit-autofill:focus,
17
- input:-webkit-autofill:active,
18
- input:autofill,
19
- input:-webkit-autofill-strong-password,
20
- input:-webkit-autofill-strong-password-viewable,
21
- input:-webkit-autofill-and-obscured {
22
- -webkit-box-shadow: 0 0 0 1000px rgba(255, 0, 0, 0) inset !important;
23
- background-color: rgb(255, 0, 0) !important;
24
- }
25
-
26
17
  /*
27
18
  * 禁止拖拽图片
28
19
  * 禁止长按弹出菜单
@@ -2,9 +2,6 @@
2
2
  // Layout 头部高度
3
3
  --jnrs-head-height: 50px;
4
4
  --jnrs-routerTabs-height: 30px;
5
-
6
- // // element-ui 样式
7
- // --el-menu-base-level-padding: 8px !important;
8
5
  }
9
6
 
10
7
  .el-button--primary {
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  @Author : TanRui
3
3
  @WeChat : Tan578853789
4
- @File : JnDictTag.vue
4
+ @File : DictTag.vue
5
5
  @Date : 2025/12/25
6
6
  @Desc. : 带颜色的字典标签
7
7
  -->
@@ -69,7 +69,7 @@ const loadFiles = async (keys: Props['loadKeys']) => {
69
69
  return { url, fileName, revoke }
70
70
  } catch (err) {
71
71
  console.warn(uniqueFileName, err)
72
- return { url: '', fileName: '', revoke: () => {} }
72
+ return { url: '', fileName: fileName || uniqueFileName, revoke: () => {} }
73
73
  }
74
74
  })
75
75
  )
@@ -102,5 +102,5 @@ onBeforeUnmount(() => {
102
102
  </script>
103
103
 
104
104
  <template>
105
- <jn-pdf-view :fileList="fileList"></jn-pdf-view>
105
+ <JnPdfView :fileList="fileList"></JnPdfView>
106
106
  </template>
@@ -0,0 +1,20 @@
1
+ <!--
2
+ @Author : TanRui
3
+ @WeChat : Tan578853789
4
+ @File : SelectManager.vue
5
+ @Date : 2025/12/31
6
+ @Desc. : 选择项目经理
7
+ -->
8
+
9
+ <script setup lang="ts">
10
+ import { DemosTableApi } from '@/api/demos/index'
11
+ import { JnSelectTemplate } from '@jnrs/vue-core/components'
12
+ </script>
13
+
14
+ <template>
15
+ <JnSelectTemplate tableName="项目经理" :keyValue="{ label: 'manager', value: 'managerId' }" :listApi="DemosTableApi">
16
+ <template #table>
17
+ <el-table-column prop="manager" label="项目经理" align="center" sortable />
18
+ </template>
19
+ </JnSelectTemplate>
20
+ </template>
@@ -11,24 +11,24 @@ import { ref, computed } from 'vue'
11
11
  export function useTable<T>(initialData: T[] = []) {
12
12
  const data = ref<T[]>(initialData)
13
13
  const pageSize = ref(10)
14
- const currentPage = ref(1)
14
+ const pageNo = ref(1)
15
15
 
16
16
  // 分页数据
17
17
  const paginatedData = computed(() => {
18
- const start = (currentPage.value - 1) * pageSize.value
18
+ const start = (pageNo.value - 1) * pageSize.value
19
19
  return data.value?.slice(start, start + pageSize.value)
20
20
  })
21
21
 
22
22
  // 设置新的数据
23
23
  const setNewData = (newData: T[]) => {
24
24
  data.value = newData
25
- currentPage.value = 1
25
+ pageNo.value = 1
26
26
  }
27
27
 
28
28
  return {
29
29
  data,
30
30
  pageSize,
31
- currentPage,
31
+ pageNo,
32
32
  paginatedData,
33
33
  setNewData
34
34
  }
@@ -11,24 +11,24 @@ import { ref, computed } from 'vue'
11
11
  export function useTable<T>(initialData: T[] = []) {
12
12
  const data = ref<T[]>(initialData)
13
13
  const pageSize = ref(10)
14
- const currentPage = ref(1)
14
+ const pageNo = ref(1)
15
15
 
16
16
  // 分页数据
17
17
  const paginatedData = computed(() => {
18
- const start = (currentPage.value - 1) * pageSize.value
18
+ const start = (pageNo.value - 1) * pageSize.value
19
19
  return data.value?.slice(start, start + pageSize.value)
20
20
  })
21
21
 
22
22
  // 设置新的数据
23
23
  const setNewData = (newData: T[]) => {
24
24
  data.value = newData
25
- currentPage.value = 1
25
+ pageNo.value = 1
26
26
  }
27
27
 
28
28
  return {
29
29
  data,
30
30
  pageSize,
31
- currentPage,
31
+ pageNo,
32
32
  paginatedData,
33
33
  setNewData
34
34
  }