diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 08ab13549a21a01b1a60aa71390fa5645e715ec9..62470a4a9cdcb72c0990b79424e146f557a4e8bf 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -561,11 +561,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 15590c192c59f507b61b2a4fe643650b6326c4d1..a6068a22905f5231e496bd5efe5593da5589ae57 100644 --- a/library/src/main/ets/util/VTableController.ets +++ b/library/src/main/ets/util/VTableController.ets @@ -157,7 +157,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 0e7ac10fde7ad8dc6862aa4abe7e0d28f1f0018b..ae371d4234357afe1bcb9d9a6fcc0c4841fc865e 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