mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-08-10 23:49:38 +08:00
解决 frame 内变量问题
This commit is contained in:
parent
0f9f003c0a
commit
f99123518a
@ -65,16 +65,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
frameInit() {
|
|
||||||
if (!this.showFrame) return;
|
|
||||||
let ctx = {
|
|
||||||
quickcommand,
|
|
||||||
utools,
|
|
||||||
parent: undefined,
|
|
||||||
};
|
|
||||||
Object.assign(this.cfw, _.cloneDeep(ctx));
|
|
||||||
},
|
|
||||||
frameLoad() {
|
frameLoad() {
|
||||||
|
this.cfw.quickcommand = _.cloneDeep(quickcommand);
|
||||||
|
this.cfw.utools = _.cloneDeep(utools);
|
||||||
this.frameHeight = Math.min(
|
this.frameHeight = Math.min(
|
||||||
this.cfw.document.documentElement.getBoundingClientRect().height,
|
this.cfw.document.documentElement.getBoundingClientRect().height,
|
||||||
this.maxHeight
|
this.maxHeight
|
||||||
@ -82,9 +75,6 @@ export default {
|
|||||||
this.$emit("frameLoad");
|
this.$emit("frameLoad");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.frameInit();
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ const quickcommand = {
|
|||||||
hints: [],
|
hints: [],
|
||||||
title: title
|
title: title
|
||||||
}
|
}
|
||||||
if (!(options instanceof Object)) return reject(new TypeError(`应为 Object, 而非 ${typeof options}`))
|
if (!_.isObject(options)) return reject(new TypeError(`应为 Object, 而非 ${typeof options}`))
|
||||||
if (options instanceof Array) props.labels = options
|
if (_.isArray(options)) props.labels = options
|
||||||
else Object.assign(props, options)
|
else Object.assign(props, options)
|
||||||
Dialog.create({
|
Dialog.create({
|
||||||
component: inputBox,
|
component: inputBox,
|
||||||
@ -35,7 +35,7 @@ const quickcommand = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
showButtonBox: (labels = ["确定"], title = "") => new Promise((reslove, reject) => {
|
showButtonBox: (labels = ["确定"], title = "") => new Promise((reslove, reject) => {
|
||||||
if (!(labels instanceof Array)) return reject(new TypeError(`应为 Array, 而非 ${typeof labels}`))
|
if (!_.isArray(labels)) return reject(new TypeError(`应为 Array, 而非 ${typeof labels}`))
|
||||||
let props = {
|
let props = {
|
||||||
labels: labels,
|
labels: labels,
|
||||||
title: title
|
title: title
|
||||||
@ -91,7 +91,7 @@ const quickcommand = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
showSelectList: (selects, options = {}) => new Promise((reslove, reject) => {
|
showSelectList: (selects, options = {}) => new Promise((reslove, reject) => {
|
||||||
if (!(selects instanceof Array)) return reject(new TypeError(`应为 Array, 而非 ${typeof selects}`))
|
if (!_.isArray(selects)) return reject(new TypeError(`应为 Array, 而非 ${typeof selects}`))
|
||||||
let defaultOptions = {
|
let defaultOptions = {
|
||||||
placeholder: "输入进行筛选,支持拼音",
|
placeholder: "输入进行筛选,支持拼音",
|
||||||
optionType: "plaintext",
|
optionType: "plaintext",
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
"program": "shell",
|
||||||
|
"cmd": "echo \"<script>function actionWithSelectedFile(file) { quickcommand.showButtonBox(['打开文件', '在文件管理器中定位', '复制文件路径']).then(x => { switch (x.id) { case 0: utools.shellOpenItem(file); break; case 1: utools.shellShowItemInFolder(file); break; case 2: utools.copyText(file); break; default: break; } }) }</script> <style> body li { list-style: none; padding: 5px 20px; margin: 10px 0; transition: .2s; height: 60px; font-size: 15px; border-radius: 6px; background: #9e9e9e26; line-height: 60px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} body li:hover { background: #009688; color: white; transition: .5s; } </style>\" \n\necho \"find / -name \\\"{{subinput}}\\\" 2>/dev/null\"\nfind / -name \"{{subinput}}\" -exec echo -n \"<li onclick=actionWithSelectedFile(this.innerText)>\"{}\"</li>\" \\; 2>/dev/null",
|
||||||
|
"scptarg": "",
|
||||||
|
"charset": {
|
||||||
|
"scriptCode": "",
|
||||||
|
"outputCode": ""
|
||||||
|
},
|
||||||
"features": {
|
"features": {
|
||||||
"code": "default_findGui",
|
"code": "default_findGui",
|
||||||
"explain": "通过 find 查找文件",
|
"explain": "通过 find 查找文件",
|
||||||
@ -12,11 +19,8 @@
|
|||||||
"linux"
|
"linux"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"program": "shell",
|
|
||||||
"cmd": "echo \"<script>function actionWithSelectedFile(file) { quickcommand.showButtonBox(['打开文件', '在文件管理器中定位', '复制文件路径']).then(x => { switch (x.id) { case 0: utools.shellOpenItem(file); break; case 1: utools.shellShowItemInFolder(file); break; case 2: utools.copyText(file); break; default: break; } }) }</script> <style> #out li { list-style: none; padding: 5px 20px; margin: 10px 0; transition: .2s; height: 60px; font-size: 15px; border-radius: 6px; background: #9e9e9e26; line-height: 60px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} #out li:hover { background: #009688; color: white; transition: .5s; } </style>\" \n\necho \"find / -name \\\"{{subinput}}\\\" 2>/dev/null\"\nfind / -name \"{{subinput}}\" -exec echo -n \"<li onclick=actionWithSelectedFile(this.innerText)>\"{}\"</li>\" \\; 2>/dev/null",
|
|
||||||
"output": "html",
|
"output": "html",
|
||||||
"hasSubInput": true,
|
"hasSubInput": true,
|
||||||
"scptarg": "",
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"默认"
|
"默认"
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user