<uni-table
class="uni-table"
ref="table"
border
stripe
emptyText="加载中......"
style="width:100%; table-layout:fixed; word-wrap:break-word;"
>
<!-- 表头行 v-if="false,不需要展示-->
<uni-tr v-if="false">
<uni-th width="30%" align="center">col1</uni-th>
<uni-th width="30%" align="center">col2</uni-th>
<uni-th width="30%" align="center">col3</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<template v-for="(row,rowIdx) in dataList" :key="rowIdx">
<uni-tr>
<uni-td class="cell" :class="{'active':isActive(rowIdx+',0')}" align="center" :key="rowIdx+',0'" :cellId="rowIdx+',0'" @tap="cellClick(rowIdx+',0')">
<div class="a">{{row[0]}}</div>
<div class="b">({{list[rowIdx][0]}}.)</div>
</uni-td>
<uni-td class="cell" :class="{'active':isActive(rowIdx+',1')}" align="center" :key="rowIdx+',1'" :cellId="rowIdx+',1'" @tap="cellClick(rowIdx+',1')">
<div class="a">{{row[1]}}</div>
<div class="b">({{list[rowIdx][1]}}.)</div>
</uni-td>
<uni-td class="cell" :class="{'active':isActive(rowIdx+',2')}" align="center" :key="rowIdx+',2'" :cellId="rowIdx+',2'" @tap="cellClick(rowIdx+',2')">
<div class="a">{{row[2]}}</div>
<div class="b">({{list[rowIdx][2]}}.)</div>
</uni-td>
</uni-tr>
</template>
</uni-table>
以上代码存在的问题:
1、uni-table里面所有class都无效,内部的uni-td以:class、:key、:cellId等等都看不到效果,但在H5上没问题
2、@click无效,只能用@tap
问题1,尤其焦急解决,求指导。
2 个回复
DCloud_UNI_JBB
稍等,晚会看下
DCloud_UNI_JBB
可以通过 table上的类名 来实现自定义样式