我遇到了v-dialog组件的Vuetify示例,该示例 具有一个称为activator的作用域插槽,定义如下:
<template v-slot:activator="{ on }">
<v-btn
color="red lighten-2"
dark
v-on="on"
>
Click Me
</v-btn>
</template>
我了解了VueJS文档中作用域插槽的用途以及解构插槽道具的概念,但我不理解v-on="on"
此示例中的含义。特别是当未使用v-on
指令指定事件时,这意味着什么?
The VueJS docs on v-on
only shows its usage in combination with event name explicitly specified (eg. v-on:click="..."
) but there is no explanation of just using it as v-on="..."
.
Can someone explain this syntax and its usage in the Vuetify example?