I have created a small vue.js component in JavaScript.
Is there an elegant way to instantiate the vue component only when the element is loaded?
The problem I am facing is that I'm receiving warnings in other HTML files where the element does not exist:
vue.js:485 [Vue warn]: Cannot find element: #item
This occurs because the JavaScript code is being executed universally.
new Vue({
el: '#item',
});
How can this issue be addressed in vue.js?