vue-element-admin 使用服务端接口替换mock接口的文档是不是可以更新下呀?

pgvzfuti  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(60)

Question(提问)

Steps to reproduce(问题复现步骤)
Screenshot or Gif(截图或动态图)
Other relevant information(格外信息)
  • Your OS:
  • Node.js version:
  • vue-element-admin version:
wrrgggsh

wrrgggsh1#

请看注释啊!!!

/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online ! ! !
*/
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

呃......好吧
我来告诉你
vue.config.js
before: require('./mock/mock-server.js') 如果不需要mock,直接删除或注释; 然后你在main.js 把 mock代码块删除或注释.
然后,你就可以愉悦的开发了。。。

hjqgdpho

hjqgdpho2#

同问,代码和文档不匹配了

w80xi6nr

w80xi6nr3#

before: require('./mock/mock-server.js')

请教下,我记得文档里说可以逐步替换mock接口的,这怎么做到的

相关问题