Difference between @click and v-on:click Vuejs

前端 未结 3 1451
时光说笑
时光说笑 2021-01-30 05:37

the questions should be enough clear :). But I can see that someone use:

Someone use:

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 06:36

    They may look a bit different from normal HTML, but : and @ are valid chars for attribute names and all Vue.js supported browsers can parse it correctly. In addition, they do not appear in the final rendered markup. The shorthand syntax is totally optional, but you will likely appreciate it when you learn more about its usage later.

    Source: official documentation.

提交回复
热议问题