Skip to content

Commit 47a8b28

Browse files
author
wilinz
committed
修复在新版本VSCODE上二维码无法显示
1 parent eb4b754 commit 47a8b28

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to the "auto-js-vscodeext-fixed" extension will be documente
44

55
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
66

7+
### 1.110.0
8+
- 修复在新版本VSCODE上二维码无法显示
9+
710
### 1.109.0
811
- 添加心跳检测(需要Autox.js 6.2.9 版本以上才会启用)
912
- 设备断开连接后关闭日志通道

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "auto-js-vsce-fixed",
33
"displayName": "Auto.js-Autox.js-VSCodeExt",
44
"description": "用于在pc上vscode中开发autoxjs的自动化脚本的插件。兼容autojs 和autoxjs,增加功能:usb方式adb进行连接; 右键【文件夹】保存项目到设备;右键【js文件】运行;js文件中点击右上角运行; 结合webpack自动编译,js自动运行到手机",
5-
"version": "1.109.0",
5+
"version": "1.110.0",
66
"publisher": "aaroncheng",
77
"icon": "logo.png",
88
"repository": {

src/extension.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ class Extension {
109109
_context.subscriptions
110110
);
111111
}
112-
this.qrCodeViewPanel.webview.html = Extension.getQrCodeHtml(url)
112+
this.qrCodeViewPanel.webview.html = this.getQrCodeHtml(url)
113113
}
114114

115-
private static getQrCodeHtml(text: string): string {
116-
const icon = Extension.getVscodeResourceUrl("logo.png")
117-
const qrcodejs = Extension.getVscodeResourceUrl("assets/qrcode.js")
115+
private getQrCodeHtml(text: string): string {
116+
const icon = Extension.getVscodeResourceUrl(this.qrCodeViewPanel, "logo.png")
117+
const qrcodejs = Extension.getVscodeResourceUrl(this.qrCodeViewPanel, "assets/qrcode.js")
118118
return `<!DOCTYPE html>
119119
<html lang="en">
120120
<head>
@@ -145,10 +145,10 @@ class Extension {
145145
</html>`
146146
}
147147

148-
private static getVscodeResourceUrl(relativePath: string): string {
149-
return vscode.Uri.file(
150-
path.join(_context.extensionPath, relativePath)
151-
).with({ scheme: 'vscode-resource' }).toString();
148+
static getVscodeResourceUrl(webviewPanel: any, relativePath: string): string {
149+
return webviewPanel.webview.asWebviewUri(
150+
vscode.Uri.file(path.join(_context.extensionPath, relativePath))
151+
);
152152
}
153153

154154
openDocument() {

0 commit comments

Comments
 (0)