From 9df955e8d694018e17c4d4550f9fa9ced6d76035 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 25 May 2022 17:52:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=B7=E6=B1=82=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/module/header/HeaderCategory.vue | 4 ++-- plugins/axios.js | 3 ++- plugins/axiosTk.js | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/layouts/module/header/HeaderCategory.vue b/layouts/module/header/HeaderCategory.vue index 727bcf9..1157eb5 100644 --- a/layouts/module/header/HeaderCategory.vue +++ b/layouts/module/header/HeaderCategory.vue @@ -99,8 +99,8 @@ export default { methods: { getList(id) { let list = this.list.filter((item) => item.id == id); - console.log(`list[0]?.list`, list[0]?.list); - return list[0]?.list; + // console.log(`list[0]?.list`, list[0]?.list); + return list[0]?.list || []; }, // 获取热门分类信息 async getCategroyData() { diff --git a/plugins/axios.js b/plugins/axios.js index 2df9ace..054eaca 100644 --- a/plugins/axios.js +++ b/plugins/axios.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-03 23:04:45 * @LastEditors: ch - * @LastEditTime: 2022-05-09 09:49:53 + * @LastEditTime: 2022-05-25 17:48:31 * @Description: file content */ let axios = null @@ -31,6 +31,7 @@ export default function({app, $axios, req}) { return Promise.reject({message:'请求出错'}); }); + $axios.defaults.timeout = 3000; axios = $axios; } export { axios } \ No newline at end of file diff --git a/plugins/axiosTk.js b/plugins/axiosTk.js index acdf289..0c89bbb 100644 --- a/plugins/axiosTk.js +++ b/plugins/axiosTk.js @@ -2,12 +2,14 @@ * @Author: ch * @Date: 2022-05-04 17:11:07 * @LastEditors: ch - * @LastEditTime: 2022-05-10 14:30:24 + * @LastEditTime: 2022-05-25 17:48:35 * @Description: file content */ let axiosTk = null; export default function ({$axios, store, route}, inject) { const $axiosTk = $axios.create(); + + $axiosTk.defaults.timeout = 3000; $axiosTk.onRequest( config =>{ if(!store.state.token){ location.href = '/';