实现编排的插入、应用、运行功能

This commit is contained in:
fofolee
2024-12-23 13:31:13 +08:00
parent a22e1e23e9
commit c8a9a63dcb
3 changed files with 40 additions and 43 deletions

View File

@@ -25,8 +25,9 @@
<!-- 固定底部 -->
<div class="composer-footer q-pa-sm q-gutter-sm row justify-end">
<q-btn label="取消" v-close-popup />
<q-btn color="primary" label="确认" @click="applyCommands" />
<q-btn color="positive" label="运行" @click="runCommands" />
<q-btn color="primary" label="插入" @click="handleComposer('insert')" />
<q-btn color="primary" label="应用" @click="handleComposer('apply')" />
<q-btn color="positive" label="运行" @click="handleComposer('run')" />
</div>
</div>
</template>
@@ -98,14 +99,10 @@ export default defineComponent({
return code.join("\n");
},
runCommands() {
handleComposer(type) {
const code = this.generateCode();
this.$emit("run", code);
},
applyCommands() {
const code = this.generateCode();
this.$emit("apply", code);
this.$emit("update:modelValue", false);
this.$emit("use-composer", { type, code });
if (type !== "run") this.$emit("update:modelValue", false);
},
},
});