The colon (:) uses data binding events, and the at symbol (@) uses method events. Colon binding has higher priority, event modifiers can be used, and the at symbol syntax is more concise.
In Vue: The difference between @
In Vue, the colon (:) and the at symbol (@ ) is a different syntax for binding event handlers. The main differences between them are as follows:
Uses:
Example:
Data binding (colon):
<code class="html"><input v-model="message"></code>
message data.
Method event (at symbol):
<code class="html"><button @click="handleClick">Click Me</button></code>
handleClick method will be called.
Other differences:
Usage Guidelines:
In general, the following guidelines should be used:The above is the detailed content of In vue: the difference with @. For more information, please follow other related articles on the PHP Chinese website!