我是一个相当新的 Vue 开发人员。
在我们的堆栈中,无论我走到哪里,我都会在我们的组件组件中看到这样的代码:
<template #item.active="{ value }">
<div :aria-label="String(value)" class="text-center">
<v-icon v-if="value === null">mdi-minus</v-icon>
<v-icon v-else color="red">mdi-close</v-icon>
</div>
</template>
对于我的一生,我无法弄清楚 #item.active
是什么(特别是 #
)确实如此。我们有许多散列项。点赞<template #item.actions-prepend="{item}">
或 <template #toolbar-extension>
谷歌搜索 # 不是一件容易的事。显然我在我的 Vue 教程中错过了这个特定的视频!
我们使用 Nuxt 和 Vuetify,不确定是否有帮助!
最佳答案
正如评论中提到的,#
符号是 v-slot
的简写。属性,正如 <template>
的用法所暗示的那样(v-slot
只允许在你的代码中使用,以及组件)。
关于javascript - Vue 中的井号 (#) 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63731076/