dcloudio / hbuilderx-extension-docs

HBuilderX使用文档、以及插件开发文档
https://hx.dcloud.net.cn
Apache License 2.0
36 stars 55 forks source link

asWebviewUri文档和代码不符,并且通过webView无法调用该方法 #53

Open Cone1989 opened 1 year ago

Cone1989 commented 1 year ago

文档描述如下:

WeChat70fbff57c3bd6c1c853c0d4e0abe1433

代码如下:

interface WebView {
    ...
    /**
     * 将本地资源转换成可在WebView中加载的Uri。
     */
    asWebviewUri(Uri: Uri): void;
}

代码中该方法没有返回值。

另外,在代码中调用的时候:

resolveCustomEditor(document, webViewPanel) {
    console.log(webViewPanel.webView)
    console.log(webViewPanel.webView.asWebviewUri)
}

打印如下:

// webView有值
WebView {
 _id: 'customeditor.htmlEdit.html.1',
_msgListeners: [],
 _html: ''

// webView.asWebviewUri为undefined
undefined

这两个问题是怎么回事?是我的版本有问题吗? 我的环境是macOS 12.3,HBuilderX版本为:3.6.15.20221228

gaoshengqing21 commented 9 months ago

我也遇到了上面的问题,您这边解决了吗