Skip to content

Commit e7dac2e

Browse files
committed
release: 1.0.3
1 parent 979dcdb commit e7dac2e

File tree

13 files changed

+205
-70
lines changed

13 files changed

+205
-70
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [1.0.3](https://github.com/pearadmin/pear-admin-naive/releases/tag/1.0.3) (2022-01-05)
2+
### Feature
3+
* **PearForm** * more feature with `PearForm` demo
4+
* **Route** * add `lateral route mode` in router
5+
* **ErrorPage** * add `404`, `403`, `500` error pages
6+
* **useApi:** setting `redo:true` with `hooks: useApi`, can specify `debounce` as number(ms) to enable function throttling requests
7+
* **useTableRequest:** setting `redo:true` with `tableHooks: useTableRequest`, can specify `debounce` as number(ms) to enable function throttling requests
8+
* **routeTabs** add `close left`, `close right`, `close other` feature in RouteTab
9+
10+
### Fix
11+
* **PageWrapper** * fix `PageWrapper` only has default slot letTopRight padding
12+
113
## [1.0.2](https://github.com/pearadmin/pear-admin-naive/releases/tag/1.0.2) (2021-12-20)
214

315
### Optimize

CHANGELOG_zh.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
## [1.0.3](https://github.com/pearadmin/pear-admin-naive/releases/tag/1.0.3) (2022-01-05)
2+
### Feature
3+
* **PearForm** * 表单 PearForm Demo更多功能
4+
* **Route** * 新增平级模式路由
5+
* **ErrorPage** * 完善404,403,500错误页面
16
* **useApi:** 新增设置 redo:true时,可指定 `debounce` 为number(ms)来开启函数节流请求
27
* **useTableRequest:** 新增设置 redo:true时,可指定 `debounce` 为number(ms)来开启函数节流请求
3-
* **routeTabs** 完善`关闭左侧``关闭右侧``关闭其它` 功能
8+
* **routeTabs** 新增 RouteTab`关闭左侧``关闭右侧``关闭其它` 功能
9+
10+
### Fix
411
* **PageWrapper** * 修复PageWrapper只有内容时左上右边距存在的问题
5-
* **PearForm** * 完善PearForm Demo更多功能
612

713
## [1.0.2](https://github.com/pearadmin/pear-admin-naive/releases/tag/1.0.2) (2021-12-20)
814

components.d.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,56 @@ declare module 'vue' {
1111
ColumnSetting: typeof import('./src/components/Table/components/ColumnSetting.vue')['default']
1212
Error403: typeof import('./src/components/Error/Error403.vue')['default']
1313
Error404: typeof import('./src/components/Error/Error404.vue')['default']
14+
Error500: typeof import('./src/components/Error/Error500.vue')['default']
1415
Footer: typeof import('./src/layouts/footer/Footer.vue')['default']
1516
FullScreen: typeof import('./src/layouts/header/FullScreen.vue')['default']
1617
G2Chart: typeof import('./src/components/AntVG2/G2Chart.vue')['default']
1718
Icon: typeof import('./src/components/Icon/Icon.vue')['default']
19+
NA: typeof import('naive-ui')['NA']
20+
NAlert: typeof import('naive-ui')['NAlert']
21+
NAvatar: typeof import('naive-ui')['NAvatar']
22+
NBadge: typeof import('naive-ui')['NBadge']
23+
NBreadcrumb: typeof import('naive-ui')['NBreadcrumb']
24+
NBreadcrumbItem: typeof import('naive-ui')['NBreadcrumbItem']
25+
NButton: typeof import('naive-ui')['NButton']
26+
NCalendar: typeof import('naive-ui')['NCalendar']
27+
NCard: typeof import('naive-ui')['NCard']
28+
NCheckbox: typeof import('naive-ui')['NCheckbox']
29+
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
30+
NDataTable: typeof import('naive-ui')['NDataTable']
31+
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
32+
NDivider: typeof import('naive-ui')['NDivider']
33+
NDropdown: typeof import('naive-ui')['NDropdown']
34+
NElement: typeof import('naive-ui')['NElement']
35+
NFormItem: typeof import('naive-ui')['NFormItem']
36+
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
37+
NGi: typeof import('naive-ui')['NGi']
38+
NGlobalStyle: typeof import('naive-ui')['NGlobalStyle']
39+
NGradientText: typeof import('naive-ui')['NGradientText']
40+
NGrid: typeof import('naive-ui')['NGrid']
41+
NH4: typeof import('naive-ui')['NH4']
42+
NH5: typeof import('naive-ui')['NH5']
43+
NInput: typeof import('naive-ui')['NInput']
44+
NLayout: typeof import('naive-ui')['NLayout']
45+
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
46+
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
47+
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
48+
NMenu: typeof import('naive-ui')['NMenu']
49+
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
50+
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
51+
NPageHeader: typeof import('naive-ui')['NPageHeader']
52+
NPopover: typeof import('naive-ui')['NPopover']
53+
NPopselect: typeof import('naive-ui')['NPopselect']
54+
NResult: typeof import('naive-ui')['NResult']
55+
NScrollbar: typeof import('naive-ui')['NScrollbar']
56+
NSlider: typeof import('naive-ui')['NSlider']
57+
NSpace: typeof import('naive-ui')['NSpace']
58+
NSpin: typeof import('naive-ui')['NSpin']
59+
NStatistic: typeof import('naive-ui')['NStatistic']
60+
NTag: typeof import('naive-ui')['NTag']
61+
NText: typeof import('naive-ui')['NText']
62+
NThemeEditor: typeof import('naive-ui')['NThemeEditor']
63+
NTooltip: typeof import('naive-ui')['NTooltip']
1864
PageWrapper: typeof import('./src/components/PageWrapper/PageWrapper.vue')['default']
1965
PButton: typeof import('./src/components/Button/PButton.vue')['default']
2066
PearContent: typeof import('./src/layouts/content/PearContent.vue')['default']

src/components/Error/Error403.vue

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1-
<script setup lang="ts"></script>
2-
3-
<template>
4-
<div> 403 you don't have permission </div>
5-
</template>
6-
7-
<style scoped></style>
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
import { useIntervalFn } from '@vueuse/core'
4+
import { useRouter } from 'vue-router'
5+
6+
const router = useRouter()
7+
8+
const timeRef = ref<number>(10)
9+
10+
const { pause } = useIntervalFn(() => {
11+
if (timeRef.value > 1) {
12+
timeRef.value--
13+
} else {
14+
pause()
15+
router.push('/')
16+
}
17+
}, 1000)
18+
</script>
19+
20+
<template>
21+
<div class="flex h-full flex-col items-center mt-20">
22+
<n-result status="403" title="您的权限不足" size="huge">
23+
<template #footer>
24+
<n-button @click="$router.push('/')">返回首页</n-button>
25+
</template>
26+
<div class="text-center">{{ timeRef }} 秒后返回首页</div>
27+
</n-result>
28+
</div>
29+
</template>

src/components/Error/Error404.vue

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,29 @@
1-
<script setup lang="ts"></script>
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
import { useIntervalFn } from '@vueuse/core'
4+
import { useRouter } from 'vue-router'
25
3-
<template>
4-
<section class="page_404">
5-
<div class="container">
6-
<div class="row">
7-
<div class="col-sm-12">
8-
<div class="col-sm-10 col-sm-offset-1 text-center">
9-
<div class="four_zero_four_bg">
10-
<h1 class="text-center">404</h1>
11-
</div>
6+
const router = useRouter()
127
13-
<div class="contant_box_404">
14-
<h3 class="h2"> Look like you're lost </h3>
8+
const timeRef = ref<number>(10)
159
16-
<p>the page you are looking for not avaible!</p>
10+
const { pause } = useIntervalFn(() => {
11+
if (timeRef.value > 1) {
12+
timeRef.value--
13+
} else {
14+
pause()
15+
router.push('/')
16+
}
17+
}, 1000)
18+
</script>
1719

18-
<NButton type="primary" class="link_404">返回</NButton>
19-
</div>
20-
</div>
21-
</div>
22-
</div>
23-
</div>
24-
</section>
20+
<template>
21+
<div class="flex h-full flex-col items-center mt-20">
22+
<n-result status="404" title="404 资源不存在" size="huge">
23+
<template #footer>
24+
<n-button @click="$router.push('/')">返回首页</n-button>
25+
</template>
26+
<div class="text-center">{{ timeRef }} 秒后返回首页</div>
27+
</n-result>
28+
</div>
2529
</template>
26-
27-
<style scoped lang="less">
28-
/*======================
29-
404 page
30-
=======================*/
31-
32-
.page_404 {
33-
padding: 40px 0;
34-
background: #fff;
35-
}
36-
37-
.page_404 img {
38-
width: 100%;
39-
}
40-
41-
.four_zero_four_bg {
42-
background-image: url('@/assets/gif/404.gif');
43-
background-repeat: no-repeat;
44-
height: 400px;
45-
background-position: center;
46-
}
47-
48-
.four_zero_four_bg h1 {
49-
font-size: 80px;
50-
}
51-
52-
.four_zero_four_bg h3 {
53-
font-size: 80px;
54-
}
55-
56-
.link_404 {
57-
margin: 20px 0;
58-
display: inline-block;
59-
}
60-
.contant_box_404 {
61-
margin-top: -50px;
62-
}
63-
</style>

src/components/Error/Error500.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
import { useIntervalFn } from '@vueuse/core'
4+
import { useRouter } from 'vue-router'
5+
6+
const router = useRouter()
7+
8+
const timeRef = ref<number>(10)
9+
10+
const { pause } = useIntervalFn(() => {
11+
if (timeRef.value > 1) {
12+
timeRef.value--
13+
} else {
14+
pause()
15+
router.push('/')
16+
}
17+
}, 1000)
18+
</script>
19+
20+
<template>
21+
<div class="flex h-full flex-col items-center mt-20">
22+
<n-result status="500" title="服务器错误" size="huge">
23+
<template #footer>
24+
<n-button @click="$router.push('/')">返回首页</n-button>
25+
</template>
26+
<div class="text-center">{{ timeRef }} 秒后返回首页</div>
27+
</n-result>
28+
</div>
29+
</template>

src/layouts/menu/useMenu.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ export function useMenu(): ReturnUseMenu {
4545
const matchLen = matchedNames.length
4646
const matchExpandKeys = matchedNames.slice(0, matchLen - 1)
4747
const openKey = matchedNames[matchLen - 1]
48+
console.log(openKey)
4849
expandKeys.value = matchExpandKeys
49-
currentMenu.value = openKey
50+
// 处理平级模式的菜单
51+
if (route?.meta?.activeMenuName) {
52+
currentMenu.value = route.meta.activeMenuName as string
53+
} else {
54+
currentMenu.value = openKey
55+
}
5056
}
5157

5258
// 展开收起

src/router/modules/errors/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ const errors: RouteRecordRaw[] = [
2626
title: '403'
2727
},
2828
component: () => import('@/views/error/403.vue')
29+
},
30+
{
31+
path: '/500',
32+
name: '500',
33+
meta: {
34+
title: '500'
35+
},
36+
component: () => import('@/views/error/500.vue')
2937
}
3038
]
3139
}

src/router/modules/system/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ const systemRoutes: RouteRecordRaw[] = [
2121
icon: 'ri:account-box-line'
2222
}
2323
},
24+
{
25+
path: 'hidePage',
26+
name: 'HidePage',
27+
component: () => import('@/views/demo/system/account/hidePage.vue'),
28+
meta: {
29+
title: 'HidePageManage',
30+
hidden: true,
31+
activeMenuName: 'User',
32+
icon: 'ri:account-box-line'
33+
}
34+
},
2435
{
2536
path: 'menus',
2637
name: 'Menus',
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts"></script>
2+
3+
<template>
4+
<PageWrapper> hidePage </PageWrapper>
5+
</template>
6+
7+
<style scoped lang="less"></style>
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
<script setup lang="ts"></script>
1+
<script setup lang="ts">
2+
import { useRouter } from 'vue-router'
3+
4+
const router = useRouter()
5+
6+
function go() {
7+
router.push('/system/hidePage')
8+
}
9+
</script>
210

311
<template>
4-
<div> account </div>
12+
<PageWrapper>
13+
<div>
14+
abcdefg account
15+
<NButton @click="go"> CLick </NButton>
16+
</div>
17+
</PageWrapper>
518
</template>
619

720
<style scoped lang="less"></style>

src/views/error/500.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts"></script>
2+
3+
<template>
4+
<Error500 />
5+
</template>
6+
7+
<style scoped></style>

types/env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ declare module 'vue-router' {
1414
hidden?: boolean
1515
/// 将所有的子级渲染为一级菜单 默认false
1616
hiddenChildren?: boolean
17+
/// 指定平级菜单的Name,用于渲染菜单的选中状态
18+
activeMenuName?: string
1719
}
1820
}
1921

0 commit comments

Comments
 (0)