问题
如下所示,如何将框1和框2的元素对齐
具体环境和代码
我是使用ant-design-vue组件, 具体代码如下
html部分:
<a-row class="section" v-if="resolvePurchasePlanList && resolvePurchasePlanList.length > 0">
<div class="detail-item-wrapper" :key="detail.id" v-for="(detail, index) in resolvePurchasePlanList">
<div class="detail-item-left" v-if="!isDetails">
<a-checkbox :checked="isSelectedPchPlanIds(selectedDetailsPchPlanIds, detail)"
@click="() => changeSelectedDetailPurchaseIds(selectedDetailsPchPlanIds, detail)"
></a-checkbox>
</div>
<table class="my-table">
<tr>
<td class="label"><span class="danger-label" v-show="!isDetails">*</span>所属项目</td>
<td colspan="3">
<span v-if="isDetails">
{{ detail.projectName }}
</span>
<a-input :value="detail.projectName" :read-only="true" v-else
:class="{ danger: detail.checkSigns.projectName }"/>
</td>
<td class="label"><span class="danger-label">*</span>采购金额</td>
<td colspan="3" style="text-align: right ">
{{ formatMoney(detail.purchaseMoneySum) }}
</td>
</tr>
<tr>
<td class="label"><span class="danger-label" v-show="!isDetails">*</span>采购内容</td>
<td class="label"><span class="danger-label" v-show="!isDetails">*</span>数量</td>
<td class="label"><span class="danger-label" v-show="!isDetails">*</span>金额</td>
<td class="label">品牌</td>
<td class="label">规格型号</td>
<td class="label">计量单位</td>
<td class="label">单价</td>
</tr>
css部分:
.my-table {
flex: 1;
width: 100%;
border-collapse: collapse;
}
.label{
padding: 10px 15px;
height: 40px;
line-height: 40px;
border: #cccccc solid 1px;
border-radius: 5px;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}
使用colgroup指定一下每列的宽度,示例如下: