Vue.jsからはじまり、laravelに付属のサンプルを試してみたいです。Laravel 5.4 Vue.JSコンポーネントのマウントに失敗しました:テンプレートまたはレンダリング関数が定義されていません
ませコンポーネントが表示されず、コンソールに私がインストール
[Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <Example>
<Root>
は、新鮮な未取得、5.2-> 5.3-> 5.4
資源/資産/ 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');
window.Vue = require('vue');
/**
* 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.
*/
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: '#app'
});
資源/資産/のJS /コンポーネント/
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
Example.vue
これは私がJS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testing</title>
<link rel="stylesheet" href="css/app.css">
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body>
<div id="app">
<example></example>
</div>
<script src="js/app.js" charset="utf-8"></script>
</body>
</html>
let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
ここにlaravel mixxはありますか? webpack.mix.jsを表示できますか?(ルートで) – cssBlaster21895
はい、私はlaravel mixを持っていて、webpackを投稿に追加しました。 –
別のものは、あなたのパッケージjsonをソースと比較することができます - 特にvueのバージョンhttps://github.com/laravel/laravel/blob/master/package.json – cssBlaster21895