Loading

vue中v-on和v-bind的区别

v-bind指令用于设置HTML属性:v-bind:href 缩写为 :href

<!-- 完整语法 -->
<a v-bind:href="url">123</a>

<!-- 缩写 -->
<a :href="url">123</a>

v-on 指令用于绑定HTML事件 :v-on:click 缩写为 @click

<!-- 完整语法 -->
<a v-on:click="doSomething">123</a>

<!-- 缩写 -->
<a @click="doSomething">123</a>

最好不要用@,因为asp.net mvc页面识别@ 不太好

<a v-on:click="doSomething">aa</a>
posted @ 2020-03-30 20:56  平头猿小哥  阅读(8841)  评论(0编辑  收藏  举报