【发布时间】:2020-11-19 11:24:14
【问题描述】:
我正在使用 Vuetify for Vue 2 创建一个数据表,并且正在使用主题。我可以通过在 headers 数组中设置一个类来更改标题列的背景颜色。但是,特殊的“全选”列不起作用。知道我需要在这里做什么吗?我尝试使用插槽来覆盖复选框,但它复制了“th”元素。我需要覆盖整个标题行吗?
模板:
<v-data-table
dense
:headers="headers"
:items="jobs"
item-key="name"
loading-text="Loading..."
class="elevation-1"
show-select
>
<template v-slot:header.data-table-select="{props,on}">
<v-simple-checkbox v-bind="props" v-on="on"></v-simple-checkbox>
</template>
<template v-slot:item.data-table-select="{isSelected,select}">
<v-simple-checkbox :value="isSelected" @input="select($event)"></v-simple-checkbox>
</template>
</v-data-table>
脚本:
data() {
return {
selected: [],
headers: [
{ type: 'checkbox', sortable: false, class: "primary" },
{ text: 'Name', value: 'name', class: "primary white--text" },
{ text: 'Description', value: 'description', class: "primary white--text" },
{ text: 'Next Fire', value: 'nextFire', class: "primary white--text" },
{ text: 'Last Fire', value: 'lastFire', class: "primary white--text" },
{ text: 'Last Duration', value: 'lastDuration', class: "primary white--text" },
{ text: 'Class', value: 'class', class: "primary white--text" },
],
...
【问题讨论】:
标签: vue.js vuejs2 vuetify.js background-color