mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 21:46:12 +08:00
修复编排中ubrowser不支持添加多个同样的操作的BUG
This commit is contained in:
parent
bbdc2c6d65
commit
c1f86c20d2
@ -14,12 +14,15 @@
|
|||||||
bordered
|
bordered
|
||||||
class="action-card cursor-pointer"
|
class="action-card cursor-pointer"
|
||||||
:class="{
|
:class="{
|
||||||
'action-selected': selectedActionKeys.includes(actionKey),
|
'action-selected': actionCount[actionKey] > 0,
|
||||||
}"
|
}"
|
||||||
@click="toggleAction(actionKey)"
|
@click="addAction(actionKey)"
|
||||||
>
|
>
|
||||||
<div class="q-pa-xs text-caption text-wrap text-center">
|
<div class="q-pa-xs text-caption text-wrap text-center">
|
||||||
{{ action.label }}
|
{{ action.label }}
|
||||||
|
<q-badge v-if="actionCount[actionKey]" color="primary" floating>
|
||||||
|
{{ actionCount[actionKey] }}
|
||||||
|
</q-badge>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +41,7 @@
|
|||||||
<q-chip
|
<q-chip
|
||||||
square
|
square
|
||||||
removable
|
removable
|
||||||
@remove="toggleAction(selectedActionKey)"
|
@remove="removeAction(index)"
|
||||||
class="text-caption q-mb-sm"
|
class="text-caption q-mb-sm"
|
||||||
:style="{
|
:style="{
|
||||||
paddingLeft: '7px',
|
paddingLeft: '7px',
|
||||||
@ -125,6 +128,13 @@ export default {
|
|||||||
selectedActionArgs() {
|
selectedActionArgs() {
|
||||||
return this.modelValue.map((x) => x.args);
|
return this.modelValue.map((x) => x.args);
|
||||||
},
|
},
|
||||||
|
actionCount() {
|
||||||
|
const count = {};
|
||||||
|
this.selectedActionKeys.forEach((key) => {
|
||||||
|
count[key] = (count[key] || 0) + 1;
|
||||||
|
});
|
||||||
|
return count;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
moveAction(index, direction) {
|
moveAction(index, direction) {
|
||||||
@ -138,13 +148,8 @@ export default {
|
|||||||
this.$emit("update:model-value", newOperation);
|
this.$emit("update:model-value", newOperation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleAction(actionKey) {
|
addAction(actionKey) {
|
||||||
const index = this.selectedActionKeys.indexOf(actionKey);
|
|
||||||
let newOperation = [...this.modelValue];
|
let newOperation = [...this.modelValue];
|
||||||
if (index !== -1) {
|
|
||||||
// 移除操作
|
|
||||||
newOperation.splice(index, 1);
|
|
||||||
} else {
|
|
||||||
// 添加操作
|
// 添加操作
|
||||||
const { config, value } = this.operationsMap[actionKey];
|
const { config, value } = this.operationsMap[actionKey];
|
||||||
const args = config?.length
|
const args = config?.length
|
||||||
@ -157,7 +162,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newOperation.push(newOperationItem);
|
newOperation.push(newOperationItem);
|
||||||
}
|
this.$emit("update:model-value", newOperation);
|
||||||
|
},
|
||||||
|
removeAction(index) {
|
||||||
|
let newOperation = [...this.modelValue];
|
||||||
|
newOperation.splice(index, 1);
|
||||||
this.$emit("update:model-value", newOperation);
|
this.$emit("update:model-value", newOperation);
|
||||||
},
|
},
|
||||||
updateActionArgs(argvIndex, argvVal, actionIndex) {
|
updateActionArgs(argvIndex, argvVal, actionIndex) {
|
||||||
@ -250,4 +259,11 @@ export default {
|
|||||||
.row.q-col-gutter-xs > * {
|
.row.q-col-gutter-xs > * {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-badge {
|
||||||
|
font-size: 10px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
right: -4px;
|
||||||
|
top: -4px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user