{"id":4477,"date":"2023-05-08T17:51:08","date_gmt":"2023-05-08T09:51:08","guid":{"rendered":"https:\/\/app.applebyme.cn\/cloud\/?p=4477"},"modified":"2023-05-08T17:51:08","modified_gmt":"2023-05-08T09:51:08","slug":"vue-springboot%e6%89%93%e5%8c%85app%e5%8e%9f%e7%90%86%e5%92%8c%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/app.applebyme.cn\/cloud\/appkaifa\/4477.html","title":{"rendered":"vue springboot\u6253\u5305app\u539f\u7406\u548c\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"<p>Vue\u548cSpring Boot\u662f\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u975e\u5e38\u6d41\u884c\u7684\u4e24\u4e2a\u6280\u672f\u6808\u3002Vue\u662f\u4e00\u4e2a\u6d41\u884c\u7684JavaScript\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u7684\u7528\u6237\u754c\u9762\u3002Spring Boot\u662f\u4e00\u4e2a\u6d41\u884c\u7684Java\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u7684\u540e\u7aef\u3002\u5c06Vue\u548cSpring Boot\u7ed3\u5408\u8d77\u6765\uff0c\u53ef\u4ee5\u6784\u5efa\u51fa\u4e00\u79cd\u975e\u5e38\u5f3a\u5927\u7684Web\u5e94\u7528\u7a0b\u5e8f\u3002\u5728<a href=\"https:\/\/appdabao.yimenapp.com\/jiage-1395.html\">h5\u6253\u5305\u6210ios\u4e0d\u4e0a\u67b6<\/a>\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5c06Vue\u548cSpring Boot\u6253\u5305\u6210\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>Vue\u548cSpring Boot\u7684\u6253\u5305\u539f\u7406<\/p>\n<p>Vue\u548cSpring Boot\u662f\u4e24\u4e2a\u4e0d\u540c\u7684\u6280\u672f\u6808\uff0cVue\u662f\u4e00\u4e2a\u524d\u7aef\u6846\u67b6\uff0cSpring Boot\u662f\u4e00\u4e2a\u540e\u7aef\u6846\u67b6\u3002Vue\u548cSpring Boot\u7684\u6253\u5305\u539f\u7406\u662f\u5c06Vue\u7684\u524d\u7aef\u4ee3\u7801\u548cSpring Boot\u7684\u540e\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u7684Jar\u5305\u3002<\/p>\n<p>\u5728Vue\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Vue CLI\u5de5\u5177\u6765\u521b\u5efa\u548c\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\u3002Vue CLI\u63d0\u4f9b\u4e86\u4e00\u4e2a\u975e\u5e38\u65b9\u4fbf\u7684\u65b9\u5f0f\u6765\u521b\u5efa\u548c\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\u3002Vue CLI\u4f7f\u7528Webpack\u6765\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u4e14\u53ef\u4ee5\u5c06\u6784\u5efa\u597d\u7684Vue\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u9759\u6001\u6587\u4ef6\u3002<\/p>\n<p>\u5728Spring Boot\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Spring Boot Maven\u63d2\u4ef6\u6765\u6784\u5efaSpring Boot\u5e94\u7528\u7a0b\u5e8f\u3002Spring Boot Maven\u63d2\u4ef6\u53ef\u4ee5\u5c06Spr<a href=\"https:\/\/appdabao.yimenapp.com\/jiage-2250.html\">ios\u5f00\u53d1\u6253\u5305\u4e0a\u4f20<\/a>ing Boot\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u7684Jar\u5305\u3002Spring Boot Maven\u63d2\u4ef6\u8fd8\u53ef\u4ee5\u5c06\u4f9d\u8d56\u7684\u5e93\u6253\u5305\u8fdbJar\u5305\u4e2d\uff0c\u4f7f\u5f97Jar\u5305\u53ef\u4ee5\u72ec\u7acb\u8fd0\u884c\u3002<\/p>\n<p>\u5c06Vue\u548cSpring Boot\u6253\u5305\u6210\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/14\/15\/04125838556.jpg\" \/><\/figure>\n<\/p>\n<p>\u7684\u8fc7\u7a0b\u662f\u5c06Vue\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d\uff0c\u7136\u540e\u5728Spring Boot\u4e2d\u63d0\u4f9b\u4e00\u4e2aWeb\u670d\u52a1\uff0c\u4f7f\u5f97Vue\u7684\u9759\u6001\u6587\u4ef6\u53ef\u4ee5\u88ab\u8bbf\u95ee\u3002<\/p>\n<p>Vue\u548cSpring Boot\u7684\u6253\u5305\u6b65\u9aa4<\/p>\n<p>\u4e0b\u9762\u662f\u5c06Vue\u548cSpring Boot\u6253\u5305\u6210\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<p>\u6b65\u9aa41\uff1a\u521b\u5efaVue\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528Vue CLI\u521b\u5efa\u4e00\u4e2aVue\u5e94\u7528\u7a0b\u5e8f\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>vue create my-vue-app<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amy-vue-app\u7684Vue\u5e94\u7528\u7a0b\u5e8f\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\uff0c\u4ee5\u4fbf\u5c06\u6784\u5efa\u597d\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm run build<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u6784\u5efa\u597d\u7684\u9759\u6001\u6587\u4ef6\u5b58\u653e\u5728dist\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>\u6b65\u9aa42\uff1a\u521b\u5efaSpring Boot\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2aSpring Boot\u5e94\u7528\u7a0b\u5e8f\u3002\u5728Spring Boot\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Spring Initializr\u6765\u521b\u5efa\u4e00\u4e2a\u57fa\u672c\u7684Spring Boot\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00Spring Initializr\u7f51\u7ad9\uff08https:\/\/start.spring.io\/\uff09\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n<p>&#8211; Project: Maven Project<\/p>\n<p>&#8211; Language: Java<\/p>\n<p>&#8211; Spring Boot: 2.4.1<\/p>\n<p>&#8211; Packaging: Jar<\/p>\n<p>&#8211; Java: 8<\/p>\n<p>\u70b9\u51fbGenerate\u6309\u94ae\uff0c\u7136\u540e\u5c06\u751f\u6210\u7684\u9879\u76ee\u4e0b\u8f7d\u5230\u672c\u5730\u3002<\/p>\n<p>\u6b65\u9aa43\uff1a\u5c06Vue\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d<\/p>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u9700\u8981\u5c06\u6784\u5efa\u597d\u7684Vue\u5e94\u7528\u7a0b\u5e8f\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d\u3002\u5728Spring Boot\u7684pom.xml\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>\n<p>\n<p>\n<p>            src\/main\/resources<\/p>\n<p>\n<p>                **\/*<\/p>\n<\/p>\n<p>\n<p>            ..\/my-vue-app\/dist<\/p>\n<p>            static<\/p>\n<\/p>\n<p>\n<p>\n<p>            org.springframework.boot<\/p>\n<p>            spring-boot-maven-plugin<\/p>\n<\/p>\n<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06Vue\u5e94\u7528\u7a0b\u5e8f\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d\u7684static\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>\u6b65\u9aa44\uff1a\u63d0\u4f9bWeb\u670d\u52a1<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u5728Spring Boot\u4e2d\u63d0\u4f9b\u4e00\u4e2aWeb\u670d\u52a1\uff0c\u4f7f\u5f97Vue\u7684\u9759\u6001\u6587\u4ef6\u53ef\u4ee5\u88ab\u8bbf\u95ee\u3002\u5728Spring Boot\u7684Application\u7c7b\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>@SpringBootApplication<\/p>\n<p>public class MyApplication {<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        SpringApplication.run(MyApplication.class, args);<\/p>\n<p>    }<\/p>\n<p>    @Controller<\/p>\n<p>    public static class StaticController {<\/p>\n<p>        @GetMapping(&#8220;\/&#8221;)<\/p>\n<p>        public String index() {<\/p>\n<p>            return &#8220;index.html&#8221;;<\/p>\n<p>        }<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u5728Spring Boot\u4e2d\u63d0\u4f9b\u4e00\u4e2aWeb\u670d\u52a1\uff0c\u5e76\u5c06\u8bbf\u95ee\u6839\u8def\u5f84\u8f6c\u53d1\u5230\u9759\u6001\u6587\u4ef6\u4e2d\u7684index.html\u6587\u4ef6\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u542f\u52a8Spring Boot\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>mvn spring-boot:run<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u542f\u52a8Spring Boot\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00http:\/\/localhost:8080\uff0c\u5373\u53ef\u8bbf\u95eeVue\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5c06Vue\u548cSpring Boot\u6253\u5305\u6210\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u5f97\u6211\u4eec\u66f4\u65b9\u4fbf\u5730\u6784\u5efa\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u3002\u6253\u5305\u7684\u539f\u7406\u662f\u5c06Vue\u7684\u9759\u6001\u6587\u4ef6\u6253\u5305\u8fdbSpring Boot\u7684Jar\u5305\u4e2d\uff0c\u5e76\u5728Spring Boot\u4e2d\u63d0\u4f9b\u4e00\u4e2aWeb\u670d\u52a1\uff0c\u4f7f\u5f97Vue\u7684\u9759\u6001\u6587\u4ef6\u53ef\u4ee5\u88ab\u8bbf\u95ee\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Vue\u548cSpring Boot\u6253\u5305\u6210\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vue\u548cSpring Boot\u662f\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u975e\u5e38\u6d41\u884c\u7684\u4e24\u4e2a\u6280\u672f\u6808\u3002Vue\u662f\u4e00\u4e2a\u6d41\u884c\u7684JavaScript\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u7684\u7528\u6237\u754c\u9762\u3002Spring Boot\u662f\u4e00\u4e2a\u6d41\u884c\u7684Ja<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[5980,1775,802,5981,3655],"class_list":["post-4477","post","type-post","status-publish","format-standard","hentry","category-appkaifa","tag-5980","tag-1775","tag-802","tag-h5app","tag-3655"],"_links":{"self":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/4477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/comments?post=4477"}],"version-history":[{"count":0,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/4477\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/media?parent=4477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/categories?post=4477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/tags?post=4477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}