diff --git a/src/components/composer/ubrowser/UBrowserOperations.vue b/src/components/composer/ubrowser/UBrowserOperations.vue index 37af6a4..0dcdbe4 100644 --- a/src/components/composer/ubrowser/UBrowserOperations.vue +++ b/src/components/composer/ubrowser/UBrowserOperations.vue @@ -14,12 +14,15 @@ bordered class="action-card cursor-pointer" :class="{ - 'action-selected': selectedActionKeys.includes(actionKey), + 'action-selected': actionCount[actionKey] > 0, }" - @click="toggleAction(actionKey)" + @click="addAction(actionKey)" >
{{ action.label }} + + {{ actionCount[actionKey] }} +
@@ -38,7 +41,7 @@ field.defaultValue) - : []; + // 添加操作 + const { config, value } = this.operationsMap[actionKey]; + const args = config?.length + ? config.map((field) => field.defaultValue) + : []; - const newOperationItem = { value, args }; - if (actionKey !== value) { - newOperationItem.key = actionKey; - } - - newOperation.push(newOperationItem); + const newOperationItem = { value, args }; + if (actionKey !== value) { + newOperationItem.key = actionKey; } + + 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); }, updateActionArgs(argvIndex, argvVal, actionIndex) { @@ -250,4 +259,11 @@ export default { .row.q-col-gutter-xs > * { padding: 2px; } + +.q-badge { + font-size: 10px; + padding: 2px 4px; + right: -4px; + top: -4px; +}