问题
uni-th 在这边是不固定的列数的,即dataList会变
在uni-th 设置固定列宽width='200',或者在uni-td 设置不生效,宽度不对
解决方法
在uni-td里面多包一层view,通过设置view的宽度来撑开uni-td
html
<uni-td v-for="(item,index) in dataList">
<view style="width: 150px;">
<uni-easyinput type="number" v-model="item.pull" @input="numberFixedDigit($event,index)"></uni-easyinput>
</view>
</uni-td>
看代码
html
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th align="center">表头1</uni-th>
<uni-th width="200" v-for="item in dataList">
<text class="th-Font-big">{{item.eur}}</text>
</uni-th>
</uni-tr>
<uni-tr>
<uni-td align="center">表头2</uni-td>
<uni-td v-for="item in dataList">{{item.total}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">表头3</uni-td>
<uni-td v-for="item in dataList">
<text class="text-red">{{item.total-item.all}}</text></uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">表头4</uni-td>
<uni-td v-for="item in dataList">{{item.before}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">表头5</uni-td>
<uni-td v-for="item in dataList">{{item.today}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">
<picker mode="date" :value="dates" @change="bindDateChange">
<view class="uni-input" style="width: 200px;">日期:{{dates}}</view>
</picker>
</uni-td>
<uni-td v-for="(item,index) in dataList">
<view style="width: 150px;">
<uni-easyinput type="number" v-model="item.pull" @input="numberFixedDigit($event,index)"></uni-easyinput>
</view>
</uni-td>
</uni-tr>
</uni-table>