Skip to content
Advertisement

Error compiling template: Component template requires a root element, rather than just text in vue.js with laravel

I am Learner in Vuejs with laravel, i created a fresh project in laravel, with vue.js frontend. but after run command php artisan serve, when i run project on webbrowser. output is blank. i checked network console, there is also the output showing in example component is blank. please help me to find my mistake.

web.php

JavaScript

welcome.blade.php

JavaScript

ExampleComponent.vue

JavaScript

app.js

JavaScript

Advertisement

Answer

JavaScript

You have to wrap the template content in a parent element, such as <div> </div>. If not Vue will show an error, explaining that every component must have a single root element.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement