如何在 Vuetify <v-data-table> 行上将“光标”设置为“指针”?

Dev*_*hon 4 vuetify.js

如何cursor: pointer在 Vuetify<v-data-table>行上设置?

我在组件中尝试了以下代码,但无法识别:

<style lang="css" scoped>
tr:hover {
  cursor: pointer;
}
</style>
Run Code Online (Sandbox Code Playgroud)

Dev*_*hon 16

我终于以这种方式修复了它:

</template>
<v-data-table class="row-pointer"></v-data-table>
<template>

<style lang="css" scoped>
.row-pointer >>> tbody tr :hover {
  cursor: pointer;
}
</style>
Run Code Online (Sandbox Code Playgroud)


小智 6

这就是您如何使用自定义 CSS 选择器覆盖 v-data-table 组件的行。接受的答案仅适用于范围内的样式。

<template>
  <v-data-table class="row-pointer" ...></v-data-table>
</template>

<style> 
.row-pointer > .v-data-table__wrapper > table > tbody > tr:hover {  
  cursor: pointer;
}
</style>
Run Code Online (Sandbox Code Playgroud)

  • 提供的答案被标记为低质量帖子以供审核。以下是[如何写出好的答案?](https://stackoverflow.com/help/how-to-answer) 的一些指南。这个提供的答案可能会受益于解释。仅代码答案不被视为“好”答案。来自[评论](https://stackoverflow.com/review/low-quality-posts/27275409)。 (2认同)