【发布时间】:2018-09-06 16:57:45
【问题描述】:
我试图在表格列中居中复选框但没有成功。无论我使用什么对齐方式,复选框总是左对齐。奇怪的是,如果我将 v-checkbox 更改为 v-btn,相同的代码也会起作用。这个问题有解决办法吗?
https://codepen.io/anon/pen/QVqqVP
这里是简单的查看代码:
<div id="app">
<v-app>
<v-content>
<v-container>
<v-data-table :items="apps" :headers="headers" hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left">
<h6 class="mb-0">{{props.item.app_name}}</h6>
</td>
<td class="text-xs-center">
<v-checkbox color="primary"/>
</td>
</template>
</v-data-table>
</v-container>
</v-content>
</v-app>
</div>
这里是 Vue 应用程序:
new Vue({
el: '#app',
data: () => ({
apps: [{'app_name':"row1"}, {'app_name':"row2"}]
})
})
【问题讨论】:
-
请分享代码sn-p。这与 CSS 无关吗?
-
text-align: center<td> -
@connexo 抱歉,但这些不起作用。结果相同。您可以在我附上的 pep 中查看。
-
另一种方法,检查this codepen,将您的复选框包裹在您自己的 div 中,然后自定义此 div。
-
您好,请告知您正在使用的 Vuetify 版本
标签: vue.js vuetify.js