Giter VIP home page Giter VIP logo

Comments (3)

woai3c avatar woai3c commented on July 29, 2024

config配置了
publicPath: './',
'/api': {
target: 'http://127.0.0.1:8083/',


}
axios配置访问
this.$axios.post('/api/testData', {}).
开发环境没错,正式环境前端tomcat8081报错,java后台还是8083端口接口
http://127.0.0.1:8081/api/testData
Failed to load resource: the server responded with a status of 404 (Not Found)。
访问地址没有代理成http://127.0.0.1:8083/testData
这些参数都加了,想知道这个怎么解决?

这只是开发环境的配置,打包后的文件是放在服务器下的。所以接口地址要和服务器地址一致。

from vue-admin-template.

GitHub1527 avatar GitHub1527 commented on July 29, 2024

前后端分离打包,java接口地址和前端服务器不一致,有没有配置?有的话告知下,谢谢哈

from vue-admin-template.

woai3c avatar woai3c commented on July 29, 2024

前后端分离打包,java接口地址和前端服务器不一致,有没有配置?有的话告知下,谢谢哈

没有特殊配置,你在前端写的API 地址多少就是多少。你可以创建一个工具函数,生成一个 axios 实例,然后把你后端的接口地址写上去,这样所有的接口都能使用。

from vue-admin-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.