下面由laravel教程欄目給大家介紹laravel前端工程化之mix,希望對需要的朋友有所幫助!
composer create-project laravel/laravel learn-mix
cd learn-mix ; npm install
npm install vue-router
import VueRouter from 'vue-router'; let routes = [ { path: '/', component: require('./components/你的組件名字') } ]; export default new VueRouter({ routes });
// 導(dǎo)入路由包 import VueRouter from 'vue-router'; // use Vue.use(VueRouter); // 導(dǎo)入路由文件 import routes from './routes.JS'; const app = new Vue({ el: '#app', // 使用路由 router: routes });
npm run dev npm run watch # 任選其一
<!doctype html> <html lang="{{ app()->getLocale() }}"> <head> <!--導(dǎo)入編譯好的CSS--> <link rel="stylesheet" href="/css/app.css"> <!--導(dǎo)入CSRF_TOKEN--> <meta name="csrf-token" content="{{ csrf_token() }}"/> </head> <body> <p id="app"> <router-view></router-view> </p> <!--導(dǎo)入編譯好的JS--> <script src="/js/app.js"></script> </body> </html>
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END