Vue事件$emit发送后$on监听失效原因
- 发送
$emit('handleEven'),接收@handle-even="handle"- 失效原因
html对大小写不敏感,并且v-on事件监听器中都会转成全小写(转成@handleeven),监听不到handleEven,所以不要使用驼峰式写法,推荐始终使用kebab-case的事件名。
- 失效原因
$emit('handleEven'),接收 @handle-even="handle"
html 对大小写不敏感,并且 v-on 事件监听器中都会转成全小写(转成@handleeven),监听不到handleEven,所以不要使用驼峰式写法,推荐始终使用 kebab-case 的事件名。