vue----mockjs
2021-04-13 13:26
标签:rom enc 数据 title cnpm image mock and localhost 2.在src目录下新建一个mock.js文件 3.在main.js引入 vue----mockjs 标签:rom enc 数据 title cnpm image mock and localhost 原文地址:https://www.cnblogs.com/cyany/p/12386260.htmlcnpm install mockjs axios --save
/*
* @Author: cyany_blue
* @Date: 2020-02-29 11:06:52
* @Last Modified by: cyany_blue
* @Last Modified time: 2020-02-29 11:55:41
*/
const Mock = require("mockjs");
console.log(Mock,"main");
const Random = Mock.Random;
Mock.mock('http://localhost:8080/api/data',(req,res)=>{
let list = [];
for(let i =0;i
require("./mock") //引入mock数据
import axios from "axios";
axios.get('http://localhost:8080/api/data').then(res=>{
console.log("mock",res);
})
下一篇:http请求和响应格式