目录

返回的html里包含数学公式,怎么合理渲染到页面

HarmonyOS目前没有提供专门的数学公式渲染组件,可以使用WebView组件来加载支持数学公式渲染的网页。

示例代码如下:

import { webview } from "@kit.ArkWeb"

@Component
export struct CourseLearning {
  private webviewController: webview.WebviewController = new webview.WebviewController();

  build() {
    Column() {
      Web({ src: $rawfile('Mathematics.html'), controller: this.webviewController })
        .domStorageAccess(true)
        .javaScriptAccess(true)
    }
  }
}

示例代码中提供的html可参考Mathematics.html。