},
"dependencies": {}
}
6.命令行(没有npm的自行下载):npm install
7.resources/assets/js下新建App.vue文件,内容如下:
<template>
<div id="app">
<router-view></router-view>
</div>
</template>8.resources/assets/js/app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/ require('./bootstrap');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
import App from './App.vue'
import VueRouter from 'vue-router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
Vue.use(VueRouter)
Vue.use(ElementUI)
const router = new VueRouter({
routes: [
{ path: '/', component: require('./components/Example.vue') }
]})
const app = new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
});
9.把resources/view/welcome.blade.php改为:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello</title>
</head>
<body>
<div id="app"></div> <script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
10.在主目录下新建gulpfile.js文件,内容:
const elixir = require('laravel-elixir');
const path = require('path'); require('laravel-elixir-vue-2');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(mix => {
// Elixir.webpack.config.module.loaders = [];
Elixir.webpack.mergeConfig({
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [
{
test: /.css$/,
loader: 'style!css'
}
] }
});
mix.sass('app.scss')
.webpack('app.js')
});
11.命令行(没有gulp,自行下载):










