mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 20:32:44 +08:00
支持选择 app 和 exe
This commit is contained in:
parent
027ce21592
commit
74cbd9d323
@ -50,10 +50,9 @@
|
|||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-file
|
<q-file
|
||||||
standout="bg-primary text-white"
|
standout="bg-primary text-white"
|
||||||
v-model="localIconFile"
|
:display-value="localIconFile || ''"
|
||||||
@update:model-value="getLocalIcon"
|
@click="getLocalIcon"
|
||||||
accept="image/*"
|
label="选择本地资源"
|
||||||
label="选择本地图片"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-avatar size="24px" v-if="dataUrl && localIconFile">
|
<q-avatar size="24px" v-if="dataUrl && localIconFile">
|
||||||
@ -141,11 +140,38 @@ export default {
|
|||||||
this.getRemoteIcon(imgUrl);
|
this.getRemoteIcon(imgUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocalIcon() {
|
getLocalIcon(e) {
|
||||||
utools.showMainWindow();
|
// q-file 无法获取 .app 的路径,改用 utools.showOpenDialog
|
||||||
this.compressingPic(window.getBase64Ico(imgPath)).then((dataUrl) => {
|
e.preventDefault();
|
||||||
|
this.localIconFile = utools.showOpenDialog({
|
||||||
|
title: "请选择图片文件或者可执行文件",
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
name: "localFile",
|
||||||
|
extensions: [
|
||||||
|
"png",
|
||||||
|
"jpg",
|
||||||
|
"jpeg",
|
||||||
|
"bmp",
|
||||||
|
"ico",
|
||||||
|
"gif",
|
||||||
|
"svg",
|
||||||
|
"app",
|
||||||
|
"exe",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})[0];
|
||||||
|
if (
|
||||||
|
this.localIconFile.slice(-4) === ".app" ||
|
||||||
|
this.localIconFile.slice(-4) === ".exe"
|
||||||
|
)
|
||||||
|
return this.setIcon(utools.getFileIcon(this.localIconFile));
|
||||||
|
this.compressingPic(window.getBase64Ico(this.localIconFile)).then(
|
||||||
|
(dataUrl) => {
|
||||||
dataUrl && this.setIcon(dataUrl);
|
dataUrl && this.setIcon(dataUrl);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getRemoteIcon(url = this.netWorkIconUrl) {
|
getRemoteIcon(url = this.netWorkIconUrl) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user