Javascript VueJS不呈现模板内容
我最近开始将我的Laravel8项目转换为VueJS,但它似乎没有呈现它的模板内容。 我使用了以下命令来包含Vue的基本结构:Javascript VueJS不呈现模板内容,javascript,laravel,vue.js,Javascript,Laravel,Vue.js,我最近开始将我的Laravel8项目转换为VueJS,但它似乎没有呈现它的模板内容。 我使用了以下命令来包含Vue的基本结构:php artisan ui Vue&&npm install app.js: require('./bootstrap'); window.Vue = require('vue').default; Vue.component('example-component', require('./components/ExampleComponent.vue').defa
php artisan ui Vue&&npm install
app.js:
require('./bootstrap');
window.Vue = require('vue').default;
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
const app = new Vue({
el: '#app',
});
webpack.mix.js:
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
主要观点:
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<body id="app">
<example-component></example-component>
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
</body>
</html>
Npm构建工作正常,没有错误。但不幸的是,模板内容在前端不可见。我看到的一切都是vue标记本身,如:
提前谢谢 根组件不应安装在body元素中,您必须执行以下操作:
<body >
<div id="app">
<example-component></example-component>
</div>
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
</body>
根组件不应安装在body元素中,您必须执行以下操作:
<body >
<div id="app">
<example-component></example-component>
</div>
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
</body>
这回答了你的问题吗?不是真的,我仍然在使用laravel mix 5.0.5,然后尝试
npm I和&npm run dev
相同,构建工作正常,但仍然没有前端输出:/<代码>window.Vue=require('Vue')。默认值towindow.Vue=require('Vue')
try this这是否回答了您的问题?不是真的,我仍然在使用laravel mix 5.0.5,然后尝试npm I和&npm run dev
相同,构建工作正常,但仍然没有前端输出:/<代码>window.Vue=require('Vue')。默认值towindow.Vue=require('Vue')
试试这个