0
저는 vue.js를 처음 사용했지만 laravel을 잘 알고 있습니다. 이제 laravel 5.3 릴리스에서 vue를 사용하여 일부 샘플 응용 프로그램을 실행하려고합니다.laravel에서 vuejs를 설정하고 실행할 수 없습니다.
자원 /의 JS/app.js :
/**
* First we will load all of this project's JavaScript dependencies which
* include Vue and Vue Resource. This gives a great starting point for
* 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 body of the page. From here, you may begin adding components to
* the application, or feel free to tweak this setup for your needs.
*/
new Vue({
el: 'body',
data: {
message: 'Hello Vue World!'
}
})
welcome.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="{{ elixir('js/app.js') }}"></script>
<link rel="stylesheet" href="{{ elixir('css/app.css') }}">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600"
rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">@{{ message }}</div>
</body>
</html>
gulpfile.js
const elixir = require('laravel-elixir');
require('laravel-elixir-vue');
/*
|--------------------------------------------------------------------------
| 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(function(mix) {
mix.sass('app.scss');
});
elixir(function(mix) {
mix.browserify('app.js');
});
elixir(function(mix) {
mix.version(['css/app.css', 'js/app.js']);
});
내가 그것을 실행할 때 나는 단지 대신 안녕하세요 뷰 세계의, {{message}}
를 참조 [Vue warn]: Cannot find element: body
어떤 도움이 감사합니다,
말하는 오류를 얻고있다. 신체의 끝 대신 머리에 스크립트 태그를 넣어 https://asked.io/quick-start-guide--laravel-5--vue-js---bootstrap-3