Do not need an expression
Parameters: id Required
Usage:
Registers an index for the DOM element, facilitating access to the element through the owning instance $els .
Attention:
Because HTML is case-insensitive, CamelCase names v-el:someEl will be converted to all lowercase. Can be v-el:some-el set with this.$els.someEl .
My understanding : $els Similar to the Document.queryselector ('. class ') function, you can get the specified DOM element.
Eg:
<div v-el:maincontainer></div>
var _dom = this. $els. Maincontainer
Note: when fetching the DOM element, the hump naming is not recognized, as in the example above, the value of the binding is Maincontainer, but only Maincontainer is written when fetching the DOM, otherwise it will not be recognized.
In fact, in the last article I used the Instance property VM of Vue. $els
HTML code:
<input type="text"class='name-input' placeholder=' please fill in the project name ' v-on:keyup.enter='saveprojectfun' v-el:addproject>
JS Code:
// Saveprojectfun:function () { var obj={} obj.success =false ; Let name =this =name.replace (/\s+/g, ); this .projectdata.push (obj); true ; }
In fact this $els. Addproject.value is equivalent to: Document.queryselector ('. Name-input'). value
Vue Instance Properties (VM. $els)