2021-4-9更
clone的vue-admin-template,下载下来后,直接更改==.env.development内的VUE_APP_BASE_API = 'http://127.0.0.1:7001’==就可调用其他接口


  1. 克隆项目
  2. 打开vue.config.js
   //注释devServer下的before
   // before: require('./mock/mock-server.js')
   devServer: {
    port: port,
    open: true,
    overlay: {
      warnings: false,
      errors: true
    }
    // before: require('./mock/mock-server.js')
   }
  1. 打开==/src/main.js==
//注释===记得有事没事看看英文
/**
 * 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()
// }
  1. 打开==.env.development==
  //编辑# base api
  //例如我的服务端是在本地,地址为http://localhost:12001
  # just a flag 
  ENV = 'development'
  # base api
  VUE_APP_BASE_API = 'http://localhost:12001'
  1. 最后一步,重启项目,end~~
Logo

前往低代码交流专区

更多推荐