Skip to content

Commit 9059843

Browse files
committed
支持 Vue 3.2.x 语法升级为,script setup
1 parent d3f7fa0 commit 9059843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2334
-2088
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# CHANGELOG
22

3+
## 1.5.5 (2021-08-14)
4+
5+
### 🐛 Bug Fixes
6+
- 修复路由只存在一个子路由,图标不显示问题
7+
- UI样式美化
8+
9+
- ### ✨ Features
10+
- 支持 Vue 3.2.x
11+
- 代码全部按 `script setup` 语法重写(完成80%)
12+
- 新增 `回到顶部` 功能
13+
- 新增 `拖拽` 示例页面
14+
- 新增 `富文本` 组件
15+
- 新增 `路由切换动画` 可在项目设置切换
16+
- 依赖升级
17+
18+
# CHANGELOG
19+
320
## 1.5.4 (2021-08-10)
421

522
### 🐛 Bug Fixes

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,7 @@ yarn build
117117

118118
- QQ 群 `328347666`
119119

120+
## 赞助
121+
#### 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 🍹。
122+
123+
![donate](https://jekip.github.io/docs/images/sponsor.png)

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "naive-ui-admin",
3-
"version": "1.5.4",
3+
"version": "1.5.5",
44
"author": {
55
"name": "Ahjung",
66
"email": "735878602@qq.com",
@@ -27,6 +27,7 @@
2727
"dependencies": {
2828
"@vicons/antd": "^0.10.0",
2929
"@vicons/ionicons5": "^0.10.0",
30+
"@vueup/vue-quill": "^1.0.0-beta.7",
3031
"@vueuse/core": "^5.0.3",
3132
"axios": "^0.21.1",
3233
"blueimp-md5": "^2.18.0",
@@ -39,11 +40,11 @@
3940
"mitt": "^2.1.0",
4041
"mockjs": "^1.1.0",
4142
"naive-ui": "^2.16.2",
42-
"pinia": "^2.0.0-beta.3",
43+
"pinia": "^2.0.0-rc.4",
4344
"qs": "^6.10.1",
4445
"vfonts": "^0.1.0",
45-
"vue": "^3.1.2",
46-
"vue-router": "^4.0.10",
46+
"vue": "^3.2.2",
47+
"vue-router": "^4.0.11",
4748
"vue-types": "^4.0.0",
4849
"vuedraggable": "^4.0.3",
4950
"vuex": "^4.0.2"
@@ -53,17 +54,17 @@
5354
"@commitlint/config-conventional": "^12.1.4",
5455
"@types/lodash": "^4.14.170",
5556
"@types/node": "^15.12.2",
56-
"@typescript-eslint/eslint-plugin": "^4.26.1",
57-
"@typescript-eslint/parser": "^4.26.1",
57+
"@typescript-eslint/eslint-plugin": "^4.29.1",
58+
"@typescript-eslint/parser": "^4.29.1",
5859
"@vitejs/plugin-vue": "^1.2.3",
5960
"@vitejs/plugin-vue-jsx": "^1.1.5",
60-
"@vue/compiler-sfc": "3.1.1",
61+
"@vue/compiler-sfc": "^3.2.2",
6162
"@vue/eslint-config-typescript": "^7.0.0",
6263
"autoprefixer": "^10.3.1",
6364
"commitizen": "^4.2.4",
6465
"core-js": "^3.14.0",
6566
"dotenv": "^10.0.0",
66-
"eslint": "^7.28.0",
67+
"eslint": "^7.32.0",
6768
"eslint-config-prettier": "^8.3.0",
6869
"eslint-define-config": "^1.0.9",
6970
"eslint-plugin-jest": "^24.4.0",

src/App.vue

Lines changed: 49 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
</transition>
1717
</template>
1818

19-
<script lang="ts">
20-
import { defineComponent, computed, onMounted, onUnmounted } from 'vue';
19+
<script lang="ts" setup>
20+
import { computed, onMounted, onUnmounted } from 'vue';
2121
import { zhCN, dateZhCN, createTheme, inputDark, datePickerDark, darkTheme } from 'naive-ui';
2222
import { LockScreen } from '@/components/Lockscreen';
2323
import { AppProvider } from '@/components/Application';
@@ -26,86 +26,61 @@
2626
import { useDesignSettingStore } from '@/store/modules/designSetting';
2727
import { lighten } from '@/utils/index';
2828
29-
export default defineComponent({
30-
name: 'App',
31-
components: { LockScreen, AppProvider },
32-
setup() {
33-
const route = useRoute();
34-
const useLockscreen = useLockscreenStore();
35-
const designStore = useDesignSettingStore();
36-
const isLock = computed(() => useLockscreen.isLock);
37-
const lockTime = computed(() => useLockscreen.lockTime);
29+
const route = useRoute();
30+
const useLockscreen = useLockscreenStore();
31+
const designStore = useDesignSettingStore();
32+
const isLock = computed(() => useLockscreen.isLock);
33+
const lockTime = computed(() => useLockscreen.lockTime);
3834
39-
/**
40-
* @type import('naive-ui').GlobalThemeOverrides
41-
*/
42-
const getThemeOverrides = computed(() => {
43-
const appTheme = designStore.appTheme;
44-
const lightenStr = lighten(designStore.appTheme, 6);
45-
return {
46-
common: {
47-
primaryColor: appTheme,
48-
primaryColorHover: lightenStr,
49-
primaryColorPressed: lightenStr,
50-
},
51-
LoadingBar: {
52-
colorLoading: appTheme,
53-
},
54-
};
55-
});
56-
57-
const getDarkTheme = computed(() => (designStore.darkTheme ? darkTheme : undefined));
35+
/**
36+
* @type import('naive-ui').GlobalThemeOverrides
37+
*/
38+
const getThemeOverrides = computed(() => {
39+
const appTheme = designStore.appTheme;
40+
const lightenStr = lighten(designStore.appTheme, 6);
41+
return {
42+
common: {
43+
primaryColor: appTheme,
44+
primaryColorHover: lightenStr,
45+
primaryColorPressed: lightenStr,
46+
},
47+
LoadingBar: {
48+
colorLoading: appTheme,
49+
},
50+
};
51+
});
5852
59-
let timer;
53+
const getDarkTheme = computed(() => (designStore.darkTheme ? darkTheme : undefined));
6054
61-
const timekeeping = () => {
62-
clearInterval(timer);
63-
if (route.name == 'login' || isLock.value) return;
64-
// 设置不锁屏
65-
useLockscreen.setLock(false);
66-
// 重置锁屏时间
67-
useLockscreen.setLockTime();
68-
timer = setInterval(() => {
69-
// 锁屏倒计时递减
70-
useLockscreen.setLockTime(lockTime.value - 1);
71-
if (lockTime.value <= 0) {
72-
// 设置锁屏
73-
useLockscreen.setLock(true);
74-
return clearInterval(timer);
75-
}
76-
}, 1000);
77-
};
55+
let timer;
7856
79-
onMounted(() => {
80-
document.addEventListener('mousedown', timekeeping);
81-
});
57+
const timekeeping = () => {
58+
clearInterval(timer);
59+
if (route.name == 'login' || isLock.value) return;
60+
// 设置不锁屏
61+
useLockscreen.setLock(false);
62+
// 重置锁屏时间
63+
useLockscreen.setLockTime();
64+
timer = setInterval(() => {
65+
// 锁屏倒计时递减
66+
useLockscreen.setLockTime(lockTime.value - 1);
67+
if (lockTime.value <= 0) {
68+
// 设置锁屏
69+
useLockscreen.setLock(true);
70+
return clearInterval(timer);
71+
}
72+
}, 1000);
73+
};
8274
83-
onUnmounted(() => {
84-
document.removeEventListener('mousedown', timekeeping);
85-
});
75+
onMounted(() => {
76+
document.addEventListener('mousedown', timekeeping);
77+
});
8678
87-
return {
88-
darkTheme: createTheme([inputDark, datePickerDark]),
89-
getDarkTheme,
90-
zhCN,
91-
dateZhCN,
92-
isLock,
93-
getThemeOverrides,
94-
};
95-
},
79+
onUnmounted(() => {
80+
document.removeEventListener('mousedown', timekeeping);
9681
});
9782
</script>
9883

9984
<style lang="less">
100-
@import 'styles/common.less';
101-
102-
.slide-up-enter-active,
103-
.slide-up-leave-active {
104-
transition: transform 0.35s ease-in;
105-
}
106-
107-
.slide-up-enter-form,
108-
.slide-up-leave-to {
109-
transform: translateY(-100%);
110-
}
85+
@import 'styles/index.less';
11186
</style>

src/api/system/role.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from '@/utils/http/axios';
33
/**
44
* @description: 角色列表
55
*/
6-
export function getRoleList() {
6+
export function getRoleList(params) {
77
return http.request({
88
url: '/role/list',
99
method: 'GET',

src/components/Form/src/BasicForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
type="primary"
103103
text
104104
icon-placement="right"
105-
v-if="overflow && isInline && getProps.showAdvancedButton"
105+
v-if="isInline && getProps.showAdvancedButton"
106106
@click="unfoldToggle"
107107
>
108108
<template #icon>

0 commit comments

Comments
 (0)