I am working on a php/laravel project that requires using some vue components in some areas. Currently, my vue component looks as follows:
import Vue from 'vue';
import Notification from "./components/Notification.vue";
window.onload = function () {
var main = new Vue({
el: '#my-app',
components: { Notification }
});
}
However, on pages where I do not have a #my-app element I am getting the following error:
[Vue warn]: Cannot find element: #my-app
Is there a way to prevent this warning? Another way to ask this is, is there way to use my notification component on pages where I need it by creating a #my-app element and not have a #my-app element altogether on pages were I do not need it?
Or if I understand this correctly, I need a root #my-app element regardless of if I'm using the Notification component?