Vuetify的数据表默认具有悬停效果。当我检查表行时,我发现应用了这个CSS类。
.theme--light.v-data-table tbody tr:hover:not(.v-data-table__expanded__content) {
background: #eee;
}
似乎这将在表格行中添加背景颜色。但是,当我将此作用域CSS添加到Vuetify组件时,<template>
<v-data-table
:headers="headers"
:items="items"
:disable-sort="true"
hide-default-footer
:item-key="itemKey"
>
<template v-for="slot in Object.keys($scopedSlots)" :slot="slot" slot-scope="scope">
<slot :name="slot" v-bind="scope" />
</template>
</v-data-table>
</template>
<script>
export default {
name: "BaseDataTable",
props: {
headers: Array,
items: Array,
itemKey: {
type: String,
default: "id"
}
}
};
</script>
<style scoped>
.theme--light.v-data-table
tbody
tr:hover:not(.v-data-table__expanded__content) {
background: #fff;
}
</style>
我添加了新的CSS,但它似乎对页面没有任何影响。即使我在背景后面添加!important
也不行。有人可以告诉我为什么这些新的CSS规则无法工作或者根本没有被应用吗?因为我甚至在控制台中都看不到它们。