프로젝트
GitHub에서 보기
yyx990803/laravel-vue-cli-3
소개
Vue CLI 3와 Laravel을 사용하는 예제 프로젝트
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLaravel + Vue CLI 3
This demo assumes you are serving this Laravel app via Valet at laracon.test. If you are serving the laravel app at a different local URL, modify it accordingly in frontend/vue.config.js.
To Run the Frontend
cd frontend
yarn # OR npm install
yarn serve # OR npm run serve
# build for production:
yarn build # OR npm run build
Steps for Scaffolding From Scratch
Create Laravel Project
laravel new my-project cd my-project # remove existing frontend scaffold rm -rf package.json webpack.mix.js yarn.lock resources/assetsCreate a Vue CLI 3 project in the Laravel app
vue create frontend # pick routerConfigure Vue project
Create
frontend/vue.config.js:module.exports = { // proxy API requests to Valet during development devServer: { proxy: 'http://laracon.test' }, // output built static files to Laravel's public dir. // note the "build" script in package.json needs to be modified as well. outputDir: '../public', // modify the location of the generated HTML file. // make sure to do this only in production. indexPath: process.env.NODE_ENV === 'production' ? '../resources/views/index.blade.php' : 'index.html' }Edit
frontend/package.json:"scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build", + "build": "rm -rf ../public/{js,css,img} && vue-cli-service build --no-clean", "lint": "vue-cli-service lint" },Configure Laravel for single-page app.
routes/web.php
<?php Route::get('/{any}', 'SpaController@index')->where('any', '.*');app/Http/Controllers/SpaController.php
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class SpaController extends Controller { public function index() { return view('index'); } }
관련 프로젝트 살펴보기
불러오는 중…