HarmonyOS 有table表格控件吗

HarmonyOS
2024-12-20 16:19:36
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
Heiang

目前没有表格组件,暂时只能使用web组件引入一个本地的html,在html中绘制一个表格。demo如下:

import web_webview from '@ohos.web.webview'

@Entry
@Component
struct TableHtml {
  controller: web_webview.WebviewController = new web_webview.WebviewController();

  build() {
    Column() {
      Button("点击此处,加载HTML富文本").onClick(() => {
        this.controller.loadData(`<html> <head> <style> .table-font-size{ font-size:20px; } </style> </head> <body bgcolor=\"white\"> <table width="1000" border="5" height="1000"> <tr class="table-font-size"> <th>Month</th> <th>Month</th> </tr> <tr class="table-font-size"> <th>Month</th> <th>Month</th> </tr> <tr class="table-font-size"> <th>Month</th> <th>Month</th> </tr> <tr class="table-font-size"> <th>Month</th> <th>Month</th> </tr> </table> </body></html>`, "text/html", "UTF-8");
      }) // 通过$rawfile加载本地资源文件。
      Web({ src: 'www', controller: this.controller }).javaScriptAccess(true).domStorageAccess(true).fileAccess(true)
      // .defaultFontSize(this.fontSize)
    }
  }
}
分享
微博
QQ
微信
回复
2024-12-20 20:04:45
相关问题
表格组件 table这种
785浏览 • 1回复 待解决
ArkUI没有table组件
4818浏览 • 1回复 待解决
那种公共的标题返回的标题控件
2325浏览 • 1回复 待解决
HarmonyOS是否刻度控件
874浏览 • 1回复 待解决
HarmonyOS 数据表格组件咨询
1487浏览 • 1回复 待解决
HarmonyOS 是否全局loading这种控件
1741浏览 • 1回复 待解决
使用List嵌套实现表格布局
1843浏览 • 1回复 待解决
Tab控件切换问题哪些?
1370浏览 • 1回复 待解决
访问控制的系统控件哪些
1448浏览 • 1回复 待解决
ATSUI可以调用JSUI的控件
2936浏览 • 0回复 待解决
HarmonyOS 是否自带吸顶效果的UI控件
800浏览 • 1回复 待解决
HarmonyOS 原生能用JS开发控件并使用
1178浏览 • 1回复 待解决
提问
该提问已有0人参与 ,帮助了0人