可视化编排的命令卡片支持禁用,复制,快速打印

This commit is contained in:
fofolee
2025-01-21 01:20:03 +08:00
parent b026b484f7
commit 7a224be9f4
19 changed files with 320 additions and 44 deletions

View File

@@ -104,7 +104,6 @@ export const imageCommands = {
width: 6,
min: 1,
step: 10,
defaultValue: "",
},
{
label: "高度(像素)",
@@ -113,7 +112,6 @@ export const imageCommands = {
width: 6,
min: 1,
step: 10,
defaultValue: "",
},
{
label: "保持宽高比",

View File

@@ -172,11 +172,12 @@ const customComponentGuide = {
description: "组件初始化时的处理",
implementation: `
// 如果没有 argvs 和 code使用默认值初始化
if (!this.modelValue.argvs && !this.modelValue.code) {
const argvs = this.modelValue.argvs || this.defaultArgvs;
if (!this.modelValue.code) {
this.$emit("update:modelValue", {
...this.modelValue,
argvs: this.defaultArgvs,
code: this.generateCode(this.defaultArgvs)
argvs,
code: this.generateCode(argvs),
});
}
`,

View File

@@ -6,6 +6,8 @@ export function generateCode(commandFlow) {
const indent = hasAsyncFunction ? " " : "";
commandFlow.forEach((cmd) => {
// 跳过禁用的命令
if (cmd.disabled) return;
if (!cmd.code) return;
let line = indent;