AI_Painting_V2.0/src/components/SwitchControl/index.vue
WangLeo b8ff25a8d7 feat: Video 平台控件配置驱动化 + UUID 模型标识 + 首尾帧双图上传
- Video 控件(proportion/time/ParamGroup)改为 config 驱动,根据 API 参数 schema 动态渲染选项
- 模型选择器改用 UUID(m.id)作为内部标识,避免同名 display_name 冲突导致错误模型配置
- getModelId 查找优先级:id → name → display_name,向下兼容
- imageUploadLimit 累加所有 imageUpload 参数 maxCount,支持首尾帧等双图模型
- buildTaskBody 将 referenceImages 按索引映射到 imageUpload 参数名
- 新增 ParamGroup(动态参数容器)+ SwitchControl(纯 CSS 开关)共享组件
- modelConfigHelper 扩展 resolution/duration 同步支持
- Select 组件 dropdown-item 添加 flex-shrink:0 防止 flex 压缩
- dialogBox 支持 beforeModel 控件分组渲染
2026-06-10 15:07:37 +08:00

82 lines
1.5 KiB
Vue

<template>
<div
class="switch-control"
:class="{ active: modelValue }"
@click="toggle"
>
<span class="switch-label">{{ label }}</span>
<span class="switch-track">
<span class="switch-thumb" />
</span>
</div>
</template>
<script setup>
const props = defineProps({
modelValue: { type: Boolean, default: false },
label: { type: String, default: '' }
})
const emit = defineEmits(['update:modelValue'])
function toggle() {
emit('update:modelValue', !props.modelValue)
}
</script>
<style lang="less" scoped>
.switch-control {
display: flex;
height: 40px;
padding: 0 15px;
justify-content: center;
align-items: center;
gap: 8px;
border-radius: 10px;
border: 1px solid #E8E9EB;
background: #f5f6f7;
cursor: pointer;
transition: background 0.2s;
&:hover {
background: #e9eaeb;
}
}
.switch-label {
font-family: "Microsoft YaHei";
font-size: 12px;
color: #999;
white-space: nowrap;
user-select: none;
}
.switch-track {
position: relative;
display: inline-block;
width: 36px;
height: 20px;
border-radius: 10px;
background: #c0c4cc;
transition: background 0.25s;
flex-shrink: 0;
.active & {
background: #000F33;
}
}
.switch-thumb {
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
border-radius: 50%;
background: #fff;
transition: transform 0.25s;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
.active & {
transform: translateX(16px);
}
}
</style>