vue.js - Laravel and Vue combined development, how to set the code directory and routing?
黄舟
黄舟 2017-05-16 16:46:33
0
1
654

The front-end team and the back-end team are working together to develop a project. The front-end uses Vue, and all data is an asynchronous request interface; the back-end uses Laravel to only provide the API interface. The company requires that the request address of the front-end page and the request address of the back-end API must be under the same domain, and the front-end and back-end must be separated to the greatest extent possible.

What I think is that the laravel framework is responsible for the routing of the api interface, and the routing of the front-end pages is allocated by the front-end staff through vue-router. The front-end only needs to put the written html, js, css/less/sass, .vue, etc. The files are given to the backend, and the backend puts the front-end files into the laravel framework, and then performs the compilation through the compilation method provided by laravel, and then the corresponding page can be accessed according to the route set by the front-end. Can such an idea be realized? Where should the front-end code be placed?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
黄舟

What I am working on is a laravel+vue single-page application project. Laravel does the API, and Vue does the page display. Because it is my own practice project, I use the hash mode of vue-router. The front-end code is placed in the resource directory according to Laravel's specifications.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template