Commit 8657f297 authored by leon's avatar leon

feat: table add cell click

parent ccbda6f0
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<scroll-view scroll-x="true" > <scroll-view scroll-x="true" >
<view class="scroll-view_H"> <view class="scroll-view_H">
<u-table > <u-table >
<u-tr> <u-tr v-if="elementInfo.table.tableHeader.showHeader" :style="[headerStyle]">
<u-th style="width: 150px;" v-for="(item, index) in columns" :key="index">{{item.title}}</u-th> <u-th v-for="(item, index) in columns" :key="index">{{item.title}}</u-th>
</u-tr> </u-tr>
<u-tr v-for="(cell, cellIndex) in chartTables" :key="cellIndex" > <u-tr v-for="(cell, cellIndex) in chartTables" :key="cellIndex" @tap="cellClick(cell)">
<u-td style="width: 150px;" v-for="(item, index) in columns" :key="index"> <u-td style="width: 150px;" v-for="(item, index) in columns" :key="index">
{{cell[item.dataIndex]}} {{cell[item.dataIndex]}}
</u-td> </u-td>
...@@ -32,6 +32,19 @@ ...@@ -32,6 +32,19 @@
chartTables: [] chartTables: []
}; };
}, },
mounted() {
},
computed: {
headerStyle() {
return {
'width': '150rpx',
'height': this.elementInfo.table.tableHeader.headerRowHeight + 'px',
'color': this.elementInfo.table.tableHeader.titleColor,
'background-color': this.elementInfo.table.tableHeader.backgroundColor,
}
}
},
methods: { methods: {
initChart() { initChart() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -39,6 +52,12 @@ ...@@ -39,6 +52,12 @@
this.chartTables = this.elementData.dataList.chartTables this.chartTables = this.elementData.dataList.chartTables
}) })
}, },
cellClick(e) {
const { index, data } = this.elementInfo.child
const paramName = this.elementInfo.table.primaryKey
const value = e[paramName]
uni.$emit('handleLinkParams', { index, paramName, value: value })
}
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment