mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
新增 window.temporaryStore
This commit is contained in:
@@ -157,10 +157,12 @@ export default {
|
||||
setTimeout(() => {
|
||||
if (this.subInputValue) querySubInput();
|
||||
}, 100);
|
||||
this.$profile.tmp.handleEnter = (event) => {
|
||||
let handler = (event) => {
|
||||
if (event.keyCode == 13) querySubInput();
|
||||
};
|
||||
document.addEventListener("keydown", this.$profile.tmp.handleEnter);
|
||||
let listener = ["keydown", handler, true];
|
||||
document.addEventListener(...listener);
|
||||
window.temporaryStore.listeners.subInputListener = listener;
|
||||
},
|
||||
// payload 临时赋值
|
||||
async getTempPayload(currentCommand) {
|
||||
@@ -204,10 +206,10 @@ export default {
|
||||
});
|
||||
},
|
||||
stopRun() {
|
||||
if (this.$profile.tmp.handleEnter) {
|
||||
if (window.temporaryStore.listeners.subInputListener) {
|
||||
this.subInputValue = "";
|
||||
document.removeEventListener("keydown", this.$profile.tmp.handleEnter);
|
||||
utools.removeSubInput();
|
||||
window.temporaryStoreSoldOut();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@@ -60,7 +60,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pinyinMatch from "pinyin-match"
|
||||
import pinyinMatch from "pinyin-match";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
window.SelectList = this;
|
||||
quickcommand.updateSelectList = (opt, id) => {
|
||||
window.temporaryStore.updateSelectList = (opt, id) => {
|
||||
if (typeof id === "undefined") this.items.push(opt);
|
||||
else this.items[id] = opt;
|
||||
};
|
||||
@@ -122,11 +122,11 @@ export default {
|
||||
},
|
||||
|
||||
onDialogHide() {
|
||||
this.clear();
|
||||
this.$emit("hide");
|
||||
},
|
||||
|
||||
onOKClick() {
|
||||
utools.removeSubInput();
|
||||
let selected =
|
||||
this.options.optionType === "json"
|
||||
? this.matchedItems[this.currentIndex]
|
||||
@@ -139,8 +139,6 @@ export default {
|
||||
},
|
||||
|
||||
onCancelClick() {
|
||||
this.setUtoolsHeight(this.listMaxHeight);
|
||||
utools.removeSubInput();
|
||||
this.hide();
|
||||
},
|
||||
|
||||
@@ -185,6 +183,12 @@ export default {
|
||||
setUtoolsHeight(height) {
|
||||
utools.setExpendHeight(Math.min(height, this.listMaxHeight));
|
||||
},
|
||||
|
||||
clear() {
|
||||
utools.removeSubInput();
|
||||
this.setUtoolsHeight(this.listMaxHeight);
|
||||
window.temporaryStoreSoldOut();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user