|
28 | 28 | <view :style="{width:column.width+'px',flex:column.width?'unset':1}" |
29 | 29 | :class="{'text-inline':textInline}" :key="cindex" class="vol-table-body-cell" |
30 | 30 | v-if="!column.hidden" v-for="(column,cindex) in columns"> |
31 | | - <view :style="column.style" class="vol-cell" @click.stop="cellClick(rowindex,row,column)" |
32 | | - v-if="column.click"> |
33 | | - <view v-if="column.formatter" v-html="rowFormatter(row,column,rowindex)"></view> |
34 | | - <view v-else="column.formatter">{{row[column.field]}}</view> |
| 31 | + <view class="vol-cell" @click.stop="cellClick(rowindex,row,column)" v-if="column.click"> |
| 32 | + <view :style="column.style" v-if="column.formatter" |
| 33 | + v-html="rowFormatter(row,column,rowindex)"></view> |
| 34 | + <view :style="column.style" v-else>{{row[column.field]}}</view> |
35 | 35 | </view> |
36 | 36 | <view class="vol-cell" v-else-if="column.formatter" |
37 | 37 | v-html="rowFormatter(row,column,rowindex)"> |
|
61 | 61 | <u-empty mode="list" v-if="!rowsData.length" text="无数据" |
62 | 62 | icon="http://cdn.uviewui.com/uview/empty/list.png"> |
63 | 63 | </u-empty> |
64 | | - <view @click="tableRowClick(rowindex,columns)" :key="rowindex" v-for="(row,rowindex) in rowsData"> |
| 64 | + <view :key="rowindex" v-for="(row,rowindex) in rowsData"> |
65 | 65 | <view v-if="titleField" class="vol-table-list-item-title"> |
66 | 66 | <view class="vol-table-list-item-title-left">{{getListTitleValue(row)}}</view> |
67 | 67 | <slot :data="row" name="title"></slot> |
68 | 68 | </view> |
69 | | - <view class="vol-table-list-item"> |
| 69 | + <view @click="tableRowClick(rowindex,columns)" class="vol-table-list-item"> |
70 | 70 | <view :key="cindex" class="vol-table-list-item-cell" |
71 | 71 | v-if="!column.hidden&&column.field!=titleField" v-for="(column,cindex) in columns"> |
72 | 72 | <view class="cell-left"> {{column.title}}</view> |
|
79 | 79 | {{rowFormatterValue(row,column)}} |
80 | 80 | </view> |
81 | 81 | <view v-else-if="column.type=='img'"> |
82 | | - <u--image style="float: right;margin-left:10px;" width="50px" height="50px" |
83 | | - radius="4px" :src="src" v-for="(src,index) in getImgSrc(row[column.field])" |
84 | | - :key="index"></u--image> |
| 82 | + <view style="float: right;margin-left:10px;" width="50px" height="50px" v-for="(src,index) in getImgSrc(row[column.field])"> |
| 83 | + <u--image |
| 84 | + width="50px" height="50px" |
| 85 | + radius="4px" :src="src" |
| 86 | + :key="index"></u--image> |
| 87 | + </view> |
85 | 88 | </view> |
86 | 89 | <view v-else-if="column.type=='date'"> |
87 | 90 | {{(row[column.field]||'').substr(0,10)}} |
|
90 | 93 | </view> |
91 | 94 | </view> |
92 | 95 | </view> |
| 96 | + <view style="margin:20rpx 0 40rpx 20rpx" @click.stop> |
| 97 | + <view :key="btnIndex" class="extent-button" v-for="(btn,btnIndex) in rowButtons(rowindex,row)"> |
| 98 | + <u-button :icon="btn.icon" :hairline="true" :shape="btn.shape" :disabled="btn.disabled" :plain="btn.plain" :type="btn.type" |
| 99 | + style="height:60rpx;" @click="rowBtnClick(btn,rowindex,row)" :text="btn.text"> |
| 100 | + </u-button> |
| 101 | + </view> |
| 102 | + </view> |
93 | 103 | </view> |
94 | 104 | <slot></slot> |
95 | 105 | </u-list> |
|
314 | 324 | }, |
315 | 325 | cellClick(rowIndex, row, column) { |
316 | 326 | this.$emit('cellClick', rowIndex, row, column) |
| 327 | + }, |
| 328 | + rowButtons(index, row) { |
| 329 | + let _buttons = []; |
| 330 | + this.$emit('rowButtons',index, row, (buttons) => { |
| 331 | + _buttons = buttons; |
| 332 | + }) |
| 333 | + console.log(_buttons) |
| 334 | + return (_buttons || [])//.reverse(); |
| 335 | + }, |
| 336 | + rowBtnClick(btn, rowindex, row) { |
| 337 | + this.$emit('rowButtonClick', btn, rowindex, row); |
317 | 338 | } |
318 | 339 | }, |
319 | 340 | created() { |
|
485 | 506 | } |
486 | 507 | } |
487 | 508 | } |
| 509 | +
|
| 510 | + .extent-button { |
| 511 | + display: inline-block; |
| 512 | + float: right; |
| 513 | + min-width: 20%; |
| 514 | + margin-right: 20rpx; |
| 515 | + margin-bottom: 20rpx; |
| 516 | + } |
488 | 517 | </style> |
0 commit comments