From 2a631fe7b7ac2d7d03acf3146c6dfa12a85287ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E7=81=BF?= <2669958319@qq.com> Date: Sun, 4 Jan 2026 16:52:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=B2=E6=9F=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Index.ets | 9 ++++++++- library/src/main/ets/util/VTableController.ets | 2 +- library/src/main/resources/rawfile/vtable_util.js | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 3b00f1d..2b259f6 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -553,11 +553,18 @@ struct Index { .backgroundColor('#70949292') .fontColor(Color.Black) .onClick(() => { + const deStyle:Record = { + "borderColor":"red", + "borderLineWidth":4, + "fontSize":20, + "bgColor":"yellow", + } this.vTableController.customRender( Math.min(this.mergeCellParams[0], this.mergeCellParams[2]), Math.min(this.mergeCellParams[1], this.mergeCellParams[3]), Math.max(this.mergeCellParams[0], this.mergeCellParams[2]), - Math.max(this.mergeCellParams[1], this.mergeCellParams[3]) + Math.max(this.mergeCellParams[1], this.mergeCellParams[3]), + 'default',deStyle ) }) Button('取消自定义渲染') diff --git a/library/src/main/ets/util/VTableController.ets b/library/src/main/ets/util/VTableController.ets index 7405725..a96b3fd 100644 --- a/library/src/main/ets/util/VTableController.ets +++ b/library/src/main/ets/util/VTableController.ets @@ -156,7 +156,7 @@ export class VTableController { } const deStyleStr = JSON.stringify(deStyle) const styleStr = JSON.stringify(style) - this.controller!.runJavaScript(`customRender(${startCol},${startRow},${endCol},${endRow},${id},${deStyleStr})`) + this.controller!.runJavaScript(`customRender(${startCol},${startRow},${endCol},${endRow},'${id}',${styleStr})`) .catch((error: Error) => { console.error("Error customRender:", error); }) diff --git a/library/src/main/resources/rawfile/vtable_util.js b/library/src/main/resources/rawfile/vtable_util.js index 73e1a09..1292736 100644 --- a/library/src/main/resources/rawfile/vtable_util.js +++ b/library/src/main/resources/rawfile/vtable_util.js @@ -214,8 +214,10 @@ function customRender(startCol, startRow, endCol, endRow, id, style) { ...optionTemp.columns[2], } + // const aa = window.tableInstance.getCustomCellStyle(startCol, startRow) console.log("=====> customRender", JSON.stringify(optionTemp.columns[2])) console.log("=====> customRender", JSON.stringify(newcolumn)) + // console.log("=====> customRender", JSON.stringify(aa.borderLineWidth)) const styleObj = { borderColor: style, borderLineWidth: 4 -- Gitee