varinput调整

This commit is contained in:
fofolee 2024-12-28 17:04:55 +08:00
parent 5f44e1dd2c
commit e1d94839e9
3 changed files with 46 additions and 46 deletions

View File

@ -86,7 +86,7 @@
</q-btn-dropdown> </q-btn-dropdown>
</template> </template>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon :name="command.icon || commandIcons[command.value] || 'code'" /> <q-icon :name="command.icon || 'code'" />
</template> </template>
</q-input> </q-input>
<!-- 强制为数字类型时不支持切换类型 --> <!-- 强制为数字类型时不支持切换类型 -->
@ -100,7 +100,7 @@
class="number-input" class="number-input"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon :name="command.icon || commandIcons[command.value] || 'code'" /> <q-icon v-if="command.icon" :name="command.icon" />
</template> </template>
<template v-slot:append> <template v-slot:append>
<!-- <q-icon name="pin" size="xs" /> --> <!-- <q-icon name="pin" size="xs" /> -->
@ -130,7 +130,6 @@
<script> <script>
import { defineComponent, inject } from "vue"; import { defineComponent, inject } from "vue";
import { commandIcons } from "js/composer/composerConfig";
export default defineComponent({ export default defineComponent({
name: "VariableInput", name: "VariableInput",
@ -148,7 +147,7 @@ export default defineComponent({
setup() { setup() {
const variables = inject("composerVariables", []); const variables = inject("composerVariables", []);
return { variables, commandIcons }; return { variables };
}, },
data() { data() {
@ -238,14 +237,14 @@ export default defineComponent({
}, },
watch: { watch: {
// // <EFBFBD><EFBFBD><EFBFBD>
modelValue: { modelValue: {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
// //
if (newVal && !this.hasSelectedVariable && !this.isNumber) { if (newVal && !this.hasSelectedVariable && !this.isNumber) {
const formattedValue = this.formatValue(newVal); const formattedValue = this.formatValue(newVal);
// <EFBFBD><EFBFBD><EFBFBD> //
if (formattedValue !== newVal) { if (formattedValue !== newVal) {
this.$emit("update:modelValue", formattedValue); this.$emit("update:modelValue", formattedValue);
} }

View File

@ -30,42 +30,42 @@
<div class="col-12"> <div class="col-12">
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.width" v-model="localConfigs.run.width"
type="number"
label="窗口宽度" label="窗口宽度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('width', $event)" @update:model-value="updateConfig('width', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.height" v-model="localConfigs.run.height"
type="number"
label="窗口高度" label="窗口高度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('height', $event)" @update:model-value="updateConfig('height', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.x" v-model="localConfigs.run.x"
type="number"
label="X坐标" label="X坐标"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('x', $event)" @update:model-value="updateConfig('x', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.y" v-model="localConfigs.run.y"
type="number"
label="Y坐标" label="Y坐标"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('y', $event)" @update:model-value="updateConfig('y', $event)"
/> />
</div> </div>
@ -76,42 +76,42 @@
<div class="col-12"> <div class="col-12">
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.minWidth" v-model="localConfigs.run.minWidth"
type="number"
label="最小宽度" label="最小宽度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('minWidth', $event)" @update:model-value="updateConfig('minWidth', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.minHeight" v-model="localConfigs.run.minHeight"
type="number"
label="最小高度" label="最小高度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('minHeight', $event)" @update:model-value="updateConfig('minHeight', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.maxWidth" v-model="localConfigs.run.maxWidth"
type="number"
label="最大宽度" label="最大宽度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('maxWidth', $event)" @update:model-value="updateConfig('maxWidth', $event)"
/> />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-input <VariableInput
v-model.number="localConfigs.run.maxHeight" v-model="localConfigs.run.maxHeight"
type="number"
label="最大高度" label="最大高度"
dense dense
outlined outlined
:command="{ inputType: 'number' }"
@update:model-value="updateConfig('maxHeight', $event)" @update:model-value="updateConfig('maxHeight', $event)"
/> />
</div> </div>
@ -186,9 +186,13 @@
<script> <script>
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import VariableInput from "../VariableInput.vue";
export default defineComponent({ export default defineComponent({
name: "UBrowserRun", name: "UBrowserRun",
components: {
VariableInput,
},
props: { props: {
configs: { configs: {
type: Object, type: Object,

View File

@ -3,22 +3,6 @@ export {
defaultUBrowserConfigs, defaultUBrowserConfigs,
} from "./ubrowserConfig"; } from "./ubrowserConfig";
// 定义命令图标映射
export const commandIcons = {
open: "folder_open",
locate: "location_on",
visit: "language",
"utools.ubrowser.goto": "public",
system: "terminal",
copyTo: "content_copy",
message: "message",
alert: "warning",
send: "send",
"utools.redirect": "alt_route",
"quickcommand.sleep": "schedule",
keyTap: "keyboard",
};
// 定义命令分类 // 定义命令分类
export const commandCategories = [ export const commandCategories = [
{ {
@ -29,11 +13,13 @@ export const commandCategories = [
value: "open", value: "open",
label: "打开文件/文件夹/软件", label: "打开文件/文件夹/软件",
desc: "文件、文件夹或软件的绝对路径", desc: "文件、文件夹或软件的绝对路径",
icon: "folder_open",
}, },
{ {
value: "locate", value: "locate",
label: "在文件管理器中定位文件", label: "在文件管理器中定位文件",
desc: "要在文件管理器里显示的文件路径", desc: "要在文件管理器里显示的文件路径",
icon: "location_on",
}, },
], ],
}, },
@ -45,12 +31,14 @@ export const commandCategories = [
value: "visit", value: "visit",
label: "用默认浏览器打开网址", label: "用默认浏览器打开网址",
desc: "要访问的网址链接", desc: "要访问的网址链接",
icon: "language",
}, },
{ {
value: "utools.ubrowser.goto", value: "utools.ubrowser.goto",
label: "用ubrowser打开网址", label: "用ubrowser打开网址",
desc: "要访问的网址链接", desc: "要访问的网址链接",
isAsync: true, isAsync: true,
icon: "public",
}, },
{ {
value: "ubrowser", value: "ubrowser",
@ -58,6 +46,7 @@ export const commandCategories = [
desc: "配置UBrowser浏览器操作", desc: "配置UBrowser浏览器操作",
hasUBrowserEditor: true, hasUBrowserEditor: true,
isAsync: true, isAsync: true,
icon: "public",
}, },
], ],
}, },
@ -69,11 +58,13 @@ export const commandCategories = [
value: "system", value: "system",
label: "执行系统命令", label: "执行系统命令",
desc: "要执行的命令行", desc: "要执行的命令行",
icon: "terminal",
}, },
{ {
value: "copyTo", value: "copyTo",
label: "将内容写入剪贴板", label: "将内容写入剪贴板",
desc: "要写入剪切板的内容", desc: "要写入剪切板的内容",
icon: "content_copy",
}, },
], ],
}, },
@ -85,16 +76,19 @@ export const commandCategories = [
value: "message", value: "message",
label: "发送系统消息", label: "发送系统消息",
desc: "要发送的系统消息文本", desc: "要发送的系统消息文本",
icon: "message",
}, },
{ {
value: "alert", value: "alert",
label: "弹窗显示消息", label: "弹窗显示消息",
desc: "要弹窗显示的消息文本", desc: "要弹窗显示的消息文本",
icon: "warning",
}, },
{ {
value: "send", value: "send",
label: "发送文本到活动窗口", label: "发送文本到活动窗口",
desc: "要发送到窗口的文本内容", desc: "要发送到窗口的文本内容",
icon: "send",
}, },
], ],
}, },
@ -106,12 +100,14 @@ export const commandCategories = [
value: "utools.redirect", value: "utools.redirect",
label: "转至指定插件", label: "转至指定插件",
desc: "要跳转至的插件名称", desc: "要跳转至的插件名称",
icon: "alt_route",
}, },
{ {
value: "quickcommand.sleep", value: "quickcommand.sleep",
label: "添加延时", label: "添加延时",
desc: "延迟的毫秒数", desc: "延迟的毫秒数",
inputType: "number", inputType: "number",
icon: "schedule",
}, },
], ],
}, },
@ -124,6 +120,7 @@ export const commandCategories = [
label: "模拟按键", label: "模拟按键",
desc: "模拟键盘按键", desc: "模拟键盘按键",
hasKeyRecorder: true, hasKeyRecorder: true,
icon: "keyboard",
}, },
], ],
}, },