fix: 🐛 修复 macOS 或 linux 下自定义依赖选项描述错误的问题

This commit is contained in:
viarotel 2023-10-21 13:58:42 +08:00
parent 48dfdcc4f0
commit 0d4b1cee13
3 changed files with 23 additions and 14 deletions

View File

@ -1,4 +1,5 @@
node_modules node_modules
dist
out
.gitignore .gitignore
dist
dist-electron
dist-release

View File

@ -283,7 +283,8 @@ export default {
} }
catch (error) { catch (error) {
if (error.message) { if (error.message) {
this.$message.warning(error.message) const message = error.message?.match(/Error: (.*)/)?.[1]
this.$message.warning(message || error.message)
} }
} }
}, },
@ -309,7 +310,8 @@ export default {
} }
catch (error) { catch (error) {
if (error.message) { if (error.message) {
this.$message.warning(error.message) const message = error.message?.match(/Error: (.*)/)?.[1]
this.$message.warning(message || error.message)
} }
} }
@ -317,12 +319,17 @@ export default {
}, },
async handleSelect({ field }, { properties, filters } = {}) { async handleSelect({ field }, { properties, filters } = {}) {
try { try {
const defaultPath = this.scrcpyForm[field]
const files = await this.$electron.ipcRenderer.invoke( const files = await this.$electron.ipcRenderer.invoke(
'show-open-dialog', 'show-open-dialog',
{ {
properties, properties,
filters, filters,
defaultPath: this.scrcpyForm[field], ...(defaultPath
? {
defaultPath,
}
: {}),
}, },
) )
@ -332,7 +339,8 @@ export default {
} }
catch (error) { catch (error) {
if (error.message) { if (error.message) {
this.$message.warning(error.message) const message = error.message?.match(/Error: (.*)/)?.[1]
this.$message.warning(message || error.message)
} }
} }
}, },

View File

@ -12,24 +12,24 @@ export default () => {
properties: ['openDirectory'], properties: ['openDirectory'],
}, },
{ {
label: 'Adb 路径', label: 'adb 路径',
field: 'adbPath', field: 'adbPath',
type: 'input.path', type: 'input.path',
value: adbPath, value: adbPath,
tips: '用于连接设备的 adb.exe 的地址,注意:该选项不受针对于单个设备配置的影响', tips: '用于连接设备的 adb 的地址,注意:该选项不受针对于单个设备配置的影响',
placeholder: '请选择 Adb.exe', placeholder: '请选择 adb',
properties: ['openFile'], properties: ['openFile'],
filters: [{ name: '请选择 Adb.exe', extensions: ['exe'] }], filters: [{ name: '请选择 adb', extensions: ['*'] }],
}, },
{ {
label: 'Scrcpy 路径', label: 'scrcpy 路径',
field: 'scrcpyPath', field: 'scrcpyPath',
type: 'input.path', type: 'input.path',
value: scrcpyPath, value: scrcpyPath,
tips: '用于控制设备的 Scrcpy.exe 的地址,注意:该选项不受针对于单个设备配置的影响', tips: '用于控制设备的 scrcpy 的地址,注意:该选项不受针对于单个设备配置的影响',
placeholder: '请选择 Scrcpy.exe', placeholder: '请选择 scrcpy',
properties: ['openFile'], properties: ['openFile'],
filters: [{ name: '请选择 Scrcpy.exe', extensions: ['exe'] }], filters: [{ name: '请选择 scrcpy', extensions: ['*'] }],
}, },
] ]
} }