|
|
@@ -57,6 +57,9 @@ const tdStyle = computed(() => {
|
|
|
if (props.isTree && props.column.field == propsOpts.iconField) {
|
|
|
style.textAlign = "left"
|
|
|
}
|
|
|
+ if (canClick.value) {
|
|
|
+ style.cursor = "pointer"
|
|
|
+ }
|
|
|
return style
|
|
|
})
|
|
|
|
|
|
@@ -70,6 +73,23 @@ const tdClass = computed(() => {
|
|
|
}
|
|
|
return classStr
|
|
|
})
|
|
|
+
|
|
|
+const tdName = computed(() => {
|
|
|
+ if (canClick.value) {
|
|
|
+ return `td-${props.column.field}`
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+})
|
|
|
+
|
|
|
+const canClick = computed(() => {
|
|
|
+ if (props.column.canClick === undefined) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if (typeof props.column.canClick == "function") {
|
|
|
+ return props.column.canClick(props.column, row.value)
|
|
|
+ }
|
|
|
+ return props.column.canClick
|
|
|
+})
|
|
|
const onToggle = () => {
|
|
|
if (!isLeaf.value) {
|
|
|
VbUtil.EventHandlerUtil.trigger(tableBox.value, "vbtable.row.tree-toggle", row.value)
|
|
|
@@ -82,7 +102,7 @@ function init() {
|
|
|
onMounted(init)
|
|
|
</script>
|
|
|
<template>
|
|
|
- <td :style="tdStyle" :class="tdClass" :rowspan="rowspan" :name="`td-${column.field}`">
|
|
|
+ <td :style="tdStyle" :class="tdClass" :rowspan="rowspan" :name="tdName">
|
|
|
<span
|
|
|
v-if="isTree && column.field == propsOpts.iconField"
|
|
|
@click="onToggle"
|