The vue el option for a vuejs instance is what can be used to select a mount point for a vuejs project. A mount point is an element in a html structure in which all elements that are nested from that element will be subject to the vuejs instance in which the vue el option is being used. Alternatively the element can have no nested content at all actually when it comes to hard coded html, and all the content will be generated by way of templates and or render functions used by the main vuejs instance that is mounted to such an element.
A mount point that is selected with the el option can be obtained by a query string that allows for selection by id, class and so forth. In addition an actual reference to the element of interest can be done as well if there is a need to do so for whatever the reason. There might be some things to be concerned about at this point when it comes to selection by class, and having more than one vue instance on a page as well.
The vue el option is used to give vuejs an existing html element to which to mount for the Vue instance that is created with the new keyword. The use of the el option will result in the Vue instance being compiled right away, which might be desirable in most use case examples. If for some reason you want to compile at a later point, the el option should be omitted and the mount method should be used instead.
To mount an element by id just give a string beginning with a hash tag and then the name of the id, just like with jQuery or querSelectorAll. The vue el option expects a string or an object that is a reference to a dom element, so another option would be to use document.getElementById or any other means by which to select by id.
Selecting by class is just a matter of using a period rather than a hash tag as with any query selector string. The thing about selecting by class is that the vue el property will only make use of a single dom element. This is because there should be only one mount point per vuejs instance.
In this example I am selecting by class and have more than one instance of vuejs. Things can get a little confusing when dealing with nested dom elements, selection by class, and more than one vue instance. It would be best to avoid these situations, but when they do happen what results does make sense to me at least.
My reasoning is that any Vue instance that exists before hand in the DOM tree should be ignored and it would appear that is what happens.
An alternative to using the vue el method is to use the $mount instance method. This allows for delaying the process of mounting to an html document if needed for some reason. There are several stages when it comes to a vuejs life cycle, and the process will come to a halt after the created lifestyle hook until the $mount method is called if the vue el option is not used for the instance.
The vue el option is then one of the basic options that I have become aware of when I first got started with vuejs. It is an option that I use in just a main parent vuejs instance, but of course not any child instances or components that this main parent instance may use. The only alternative to the vue el option would be using the mount method, thus far I can not say that I use that method often in actually projects, but when it comes to mounting to the hard coded html manually that is how to go about doing it.