🐞 fix:解决mock问题

This commit is contained in:
sundongyu 2024-04-06 15:44:32 +08:00
parent 12f2274971
commit 855f64b21c
3 changed files with 3 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import sdy from './modules/sdy' import sdy from './modules/sdy'
import ycy from './modules/ycy' import ycy from './modules/ycy'
export default [ export default [
...SDY, ...sdy,
...YCY ...ycy
] ]

View File

@ -16,7 +16,7 @@ const StockList = Mock.mock({
export default [ export default [
{ {
url: "/stockList", url: "/api/stockList",
method: "get", method: "get",
response: () => { response: () => {
const obj = { const obj = {

View File

@ -1,7 +1,6 @@
// 进行axios二次封装使用请求与响应拦截器 // 进行axios二次封装使用请求与响应拦截器
import axios from "axios"; import axios from "axios";
import { MessagePlugin } from "tdesign-vue-next"; import { MessagePlugin } from "tdesign-vue-next";
import { useRouter } from "vue-router";
// 第一步:利用axios对象的create方法去创建axios实例(其他的配置:基础的路径、超时的时间) // 第一步:利用axios对象的create方法去创建axios实例(其他的配置:基础的路径、超时的时间)
const request = axios.create({ const request = axios.create({
@ -10,8 +9,6 @@ const request = axios.create({
}); });
// 第二步axios实例添加请求与响应拦截器 // 第二步axios实例添加请求与响应拦截器
request.interceptors.request.use((config) => { request.interceptors.request.use((config) => {
// config配置对象headers属性请求头经常给服务器端携带公共参数
// 返回配置对象
return config; return config;
}); });