详解Laravel前端工程化之mix

下面由laravel教程栏目给大家介绍laravel前端工程化之mix,希望对需要的朋友有所帮助!

详解Laravel前端工程化之mix

laravel

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 });
// 导入路由包 import VueRouter from 'vue-router';  // use Vue.use(VueRouter);  // 导入路由文件 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>     <!--导入编译好的CSS-->     <link rel="stylesheet" href="/css/app.css">     <!--导入CSRF_TOKEN-->     <meta name="csrf-token" content="{{ csrf_token() }}"/> </head> <body> <p id="app">     <router-view></router-view> </p> <!--导入编译好的JS--> <script src="/js/app.js"></script> </body> </html>

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享