Vue项目【饿了么App】mock数据【data.json】
2024-09-29 22:33:29
1、前后端分离式开发,约定好数据字段接口!
2、前端mock静态数据,开发完毕后,与后端进行数据联调!
3、vue.config.js 配置 devServer
const appData = require('./data.json')
const seller = appData.seller
const goods = appData.goods
const ratings = appData.ratings
module.exports = {
css: {
loaderOptions: {
stylus: {
'resolve url': true,
'import': [
'./src/theme'
]
}
}
},
pluginOptions: {
'cube-ui': {
postCompile: true,
theme: true
}
},
devServer: {
before(app) {
app.get('/api/seller',function(req, res) {
res.json({
errno:0,
success:200,
data:seller
})
})
app.get('/api/goods',function(req, res) {
res.json({
errno:0,
success:200,
data:goods
})
})
app.get('/api/ratings',function(req, res) {
res.json({
errno:0,
success:200,
data:ratings
})
})
},
}
}
4、npm run server 重启服务
5、拿到 seller、goods、ratings 数据
最新文章
- MailKit---获取邮件
- [转]LUA元表
- 第五天:内置对象(7.Javascript内置对象)
- Git常用命令总结(超实用)
- PostgreSQL删除表
- JVM内存堆布局图解分析
- Asp.Net MVC4下设置W3P3(IIS)调试步骤
- javascript 的对象
- VisualC++2012 Compiler Warning C4566
- Paint与Canvas的简单用法
- JAVA基础知识总结:九
- fabric使用
- echo的运行
- Spring MVC4 + Spring Security4 + Hibernate实例
- MySQL数据库基本用法
- [转载]WebService服务的三种途径Endpoint Disco WSDL 有什么不同
- Eclipse个人规范化设置
- Python3基础 time.localtime 当前系统的年月日 时分秒
- redis调优
- PTHREAD的WINDOWS开发包
热门文章
- 源码搭建mysql5.7.20
- iOS即时通讯之CocoaAsyncSocket源码解析四
- flex 数字上标
- js-禁止长页面滚动
- 排序算法六:计数排序(Counting sort)
- Nginx配置之rewrite、proxy_pass、upstream、location
- Mybatis-基本步骤
- ./configure 配置文件时出错checking for g++... no
- (一:NIO系列)JAVA NIO 简介
- JEECG 深度使用培训班 周六周日公开课(一期班)