1.composer create-porject --prefer-dist laravel/laravel example 创建新项目
2.cd example 进入项目
3. npm install 安装前端依赖库
4.创建laravel 视图文件 在resources/views目录下新建index.blade.php模板文件,与vue交互
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Example</title>
</head>
<body>
<div id="app"></div>
<script src="{
{ mix('js/app.js') }}"></script>
</body>
</html>
5.修改routes/web.php路由文件为
Route::get('/', function () {
return view('index');
});
6.
在 resources/assets/js/components目录下新建Exampl