[Vue warn]: Cannot find element: #app I am working on a Laravel app where VueJS integrated inside Larevel Blade file. I added app.js file like below.
if(Request::is('admin/time')) {
<script src="{{ asset('js/app.js') }}" async defer></script>
}
</body>
</html>
But I am getting error [Vue warn]: Cannot find element: #app. If I visit VueJS component page I am not getting error. But if I visit other pages I am getting error.
I added #app is like below.
const app = new Vue({
el: '#app',
});
You need to have an element in your view with the id of app
<div id="app></div>
@Tray2 Thanks. I did that also.
@Sinnbeck Thanks. I did it previously when I was getting that error. Error is not solved. Thanks.
@afoysal Then open the dev tool (F12 -> elements) and see if you can find <div id="app></div>. My bet is that it isnt there
@Sinnbeck Thanks. I added app id in a blade file. If I browse that page then I am not getting that error. But if I browse other pages then I am getting this error. I am using VueJS component in a blade file. Thanks.
@afoysal So those pages that does not work. Do they have the div mentioned above ? Are you routing in laravel or vue ?
@Sinnbeck Thanks. I am routing Laravel. My blade file is like below.
@extends('layouts.admin.app')
@section('title', 'Time')
@push('css_or_js')
@endpush
@section('content')
<div id="app">
<time-component />
</div>
@endsection
@afoysal And
So those pages that does not work. Do they have the div mentioned above ?
@Sinnbeck Thanks. No. they have not the div mentioned above.
Please sign in or create an account to participate in this conversation.