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

View File

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

View File

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