After springboot + vue deployment indicated no css

  • Background: The use of a separate project vscode vue separate development, in order to facilitate the deployment. After npm is run build, copy dist inside the static files to springboot project, and then use the built-tomcat as a web project running.
  • Phenomenon: whether used in vscode in npm run dev, or run the web project idea, all the menu items, and pages work well.
  • Question: But the idea by maven package out of the jar file, use separate java -jar running time, access to a menu item did not respond (F12 to view the console prompt can not find a style css file)
    image

  • Thinking: where there is a father of the pit where it is needed introspection. Was initially discovered when carte menu did not respond, has been in the direction of the router to find the problem, and then request to see the network of networks (the content too much, do not see the css, but also focus on the api request), no the first time to see the console thing, remember the last time there is also a question of vue. After the project point of vue did not respond, the first choice should be to see the console, see if it is being given a js Then, find the error message is not able to find the css style, although found css style file jar package (but the size is 0kb), have not been taken seriously, because it's packaged in vscode static file is 0kb of the css styles, idea is also 0kb are operating normally. But back to the actual test menu that did not fail, and then packaged together after css content, the content of the css style file, and whether it is a separate jar package to run, run, or idea are normal. Vue therefore concluded that a single page, style file must have seemingly content. Otherwise run separately packaged jar will be problems.
<style scoped>
这里需要写样式的内容,貌似不能为空,否则放在单独打包的jar运行有问题。
</style>

Guess you like

Origin www.cnblogs.com/falcon-fei/p/11700314.html