
1***@163.com
- 发布:2024-11-20 14:52
- 更新:2024-11-21 14:08
- 阅读:286

套马杆的套子 - 没有解决不了的问题,只有解决不完的问题
你看下,我刚试的,可以啊
<template>
<view>
<view class="uni-container">
<uni-table ref="table">
<uni-tr>
<uni-th width="150" align="center">日期</uni-th>
<uni-th width="150" align="center">姓名</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td>{{ item.date }}</uni-td>
<uni-td >
<view class="name" :class="[tdBg(index)]">{{ item.name }}</view>
</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tableData: [{
"date": "2020-09-01",
"name": "Dcloud1",
"address": "上海市普陀区金沙江路 1518 弄"
}, {
"date": "2020-09-02",
"name": "Dcloud2",
"address": "上海市普陀区金沙江路 1517 弄"
}, {
"date": "2020-09-03",
"name": "Dcloud3",
"address": "上海市普陀区金沙江路 1519 弄"
}]
};
},
methods:{
tdBg(index){
if(index==1){
return 'red-cls'
}else{
return 'gr-cls'
}
}
}
};
</script>
<style>
.red-cls{
background-color: red;
}
.gr-cls{
background-color: green;
}
</style>
1***@163.com (作者)
不行,不生效
2024-11-20 17:25
套马杆的套子
回复 1***@163.com: app端还是web端
2024-11-21 08:26
1***@163.com (作者)
回复 套马杆的套子:小程序
2024-11-21 13:42
套马杆的套子
回复 1***@163.com: 你看下面我试的,tr td 还有view都可以
2024-11-21 14:14