refactor: 项目优化

This commit is contained in:
郝先瑞
2022-03-07 21:17:22 +08:00
parent 3a5399e7d5
commit 5420e8ed77
9 changed files with 25 additions and 20 deletions

View File

@@ -111,8 +111,8 @@ function clearSelected() {
allNode.forEach((element) => element.classList.remove('is-current'))
}
onMounted(() => {
nextTick(() => {
function initHandle(){
nextTick(() => {
const selectedValue = modelValue.value;
if (selectedValue !== null && typeof (selectedValue) !== "undefined") {
const node = proxy.$refs.selectTree.getNode(selectedValue)
@@ -125,6 +125,10 @@ onMounted(() => {
}
}
})
}
onMounted(() => {
initHandle();
})
watch(modelValue, () => {

8
src/env.d.ts vendored
View File

@@ -7,11 +7,13 @@ declare module '*.vue' {
export default component
}
// 环境变量智能提示
// 环境变量 TypeScript的智能提示
interface ImportMetaEnv {
NODE_ENV:string,
VITE_APP_TITLE: string,
VITE_APP_PORT: string,
VITE_APP_BASE_API: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@@ -5,7 +5,7 @@ import {useUserStoreHook} from "@/store/modules/user";
// 创建 axios 实例
const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API as any,
baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 50000,
headers: {'Content-Type': 'application/json;charset=utf-8'}
})
@@ -28,7 +28,6 @@ service.interceptors.request.use(
// 响应拦截器
service.interceptors.response.use(
({data}) => {
// 对响应数据做点什么
const {code, msg} = data;
if (code === '00000') {
return data;