计算机网络/计算机科学与应用/系统/运维/开发

Vue 指令

指令:

一、参数

<img v-bind:src="imageSrc">

<button v-on:click="search">搜索</button>

click为参数


二、动态参数

指令:[表达式]


<img v-bind:[attr]="imageSrc">

比如在数据对象中有一个attr属性,值为src那么等价于

v-bind:src


三、修饰符

修饰符一般在参数后面


例如,.prevent修饰符用于调用event.preventDefault()

<form v-on:submit.prevent="onSubmit"></form>


热爱可抵岁月漫长, 温柔可挡艰难时光。

评论

^