Skip to content

Commit

Permalink
add node version controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jzfai committed Jan 4, 2022
1 parent d436692 commit a3785e8
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 4 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,13 @@
"vite-plugin-style-import": "1.2.1",
"vite-plugin-svg-icons": "1.0.5",
"vue-tsc": "0.28.1"
},
"browserslist": [
"> 1%",
"not ie 11",
"not op_mini all"
],
"engines": {
"node": ">= 14"
}
}
2 changes: 1 addition & 1 deletion src/layout/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Hamburger from './Hamburger'
import { computed, getCurrentInstance } from 'vue'
import { useStore } from 'vuex'
const store = useStore()
let settings = computed(() => {
const settings = computed(() => {
return store.state.app.settings
})
const opened = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/layout/components/Sidebar/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { useStore } from 'vuex'
const store = useStore()
let settings = computed(() => {
const settings = computed(() => {
return store.state.app.settings
})
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const mutations = {
* data:ObjType
* such as {sidebarLogo:false}
* */
M_settings: (state, data) => {
M_settings: (state:AppTy, data:ObjTy) => {
state.settings = { ...state.settings, ...data }
},
M_sidebar_opened: (state: AppTy, data: boolean) => {
Expand Down
60 changes: 60 additions & 0 deletions src/utils/mockAxiosReq.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { AxiosReqTy } from '~/common'

// create an axios instance
const service= axios.create({
baseURL: '', // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
timeout: 8000 // request timeout
})

// request interceptor
service.interceptors.request.use(
(config:AxiosReqTy) => {
return config
},
(error) => {
return Promise.reject(error)
}
)

// response interceptor
service.interceptors.response.use(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/

/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
(response) => {
const res = response.data

// if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) {
ElMessage({
message: res.ElMessage || 'Error',
type: 'error',
duration: 5 * 1000
})
return Promise.reject(new Error(res.ElMessage || 'Error'))
} else {
return res
}
},
(error) => {
console.log('err' + error) // for debug
ElMessage({
message: error.ElMessage,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)

export default service
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//移除注解
"removeComments": true,
//不可以忽略any
"noImplicitAny": false,
"noImplicitAny": true,
//关闭 this 类型注解提示
"noImplicitThis": true,
//null/undefined不能作为其他类型的子类型:
Expand Down
1 change: 1 addition & 0 deletions typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ declare let onlyOneChild: any

//declare import module
declare module '*/**'
declare module '*'


0 comments on commit a3785e8

Please sign in to comment.