在vue/cli /“bootstrap-vue”中使用https://bootstrap-vue.js.org/docs/components/table:"^2.1.0“我找不到如何为所有列设置对齐以及为任何列更改它。我试着这样做:
<b-card-body>
<b-table responsive="sm" striped hover small :items="users" :fields="usersFields" align-v="end">
<template v-slot:cell(id)="data">
<div class="-align-right">{{ data.value }}</div>
</template>
<template v-slot:cell(status)="data" >
<div class="-align-left">{{ getDictionaryLabel( data.value, userStatusLabels ) }}</div>
</template>
但失败了,因为所有列都居中。
有多正确?
发布于 2020-01-16 17:46:25
类-align-right
和-align-left
不是有效的引导v4 CSS类名。Bootstrap文本对齐类包括:
text-right
text-left
text-center
请参阅https://getbootstrap.com/docs/4.4/utilities/text/#text-alignment
发布于 2021-06-28 11:52:53
我最喜欢的方式是在字段选项中设置:
usersFields: [
{
key: 'id',
label: 'ID',
thClass: 'text-right',
tdClass: 'text-right',
},
{
key: 'status',
label: 'Status',
thClass: 'text-left',
tdClass: 'text-left',
},
]
https://stackoverflow.com/questions/59768981
复制相似问题