openharmony 鸿蒙 arkts-basic-components-web-ConsoleMessage

2025-06-12 浏览 (1)

Class (ConsoleMessage)

Web组件获取控制台信息对象。示例代码参考onConsole事件

说明:

  • 该组件首批接口从API version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。

  • 本Class首批接口从API version 8开始支持。

  • 示例效果请以真机运行为准。

constructor(deprecated)

constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel)

ConsoleMessage的构造函数。

说明:

从API version 8开始支持,从API version 9开始废弃。建议使用constructor代替。

系统能力: SystemCapability.Web.Webview.Core

参数:

参数名类型必填说明
messagestringConsoleMessage的日志输出信息。
sourceIdstring网页源文件的路径和文件名。
lineNumbernumberConsoleMessage的行号。
messageLevelMessageLevelConsoleMessage的日志级别。

constructor9+

constructor()

ConsoleMessage的构造函数。

系统能力: SystemCapability.Web.Webview.Core

getLineNumber

getLineNumber(): number

获取ConsoleMessage的行数。

系统能力: SystemCapability.Web.Webview.Core

返回值:

类型说明
number返回ConsoleMessage的行数。

getMessage

getMessage(): string

获取ConsoleMessage的日志信息。

系统能力: SystemCapability.Web.Webview.Core

返回值:

类型说明
string返回ConsoleMessage的日志信息。

getMessageLevel

getMessageLevel(): MessageLevel

获取ConsoleMessage的信息级别。

系统能力: SystemCapability.Web.Webview.Core

返回值:

类型说明
MessageLevel返回ConsoleMessage的信息级别。

getSourceId

getSourceId(): string

获取网页源文件路径和文件名。

系统能力: SystemCapability.Web.Webview.Core

返回值:

类型说明
string返回网页源文件路径和文件名。

getSource23+

getSource(): ConsoleMessageSource

获取ConsoleMessage的日志来源。

系统能力: SystemCapability.Web.Webview.Core

返回值:

类型说明
ConsoleMessageSource返回ConsoleMessage的日志来源。

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/QihEkF