Commit 584add82 by liimin

refactor: VCard -> VSection, enhance component signatures, add skip-validate UI option

1 parent 38c27cc6
......@@ -3,7 +3,7 @@
"packageName": "@vui/mobile",
"packageRoot": "packages/vui/mobile",
"framework": "vue",
"notes": "VUI Mobile 组件语义索引,面向移动端 H5,底层基于 Vant 4。当前覆盖 VButton、VCard、VCell、VDropdownMenu、VDropdownItem、VField、VImage、VList、VNavBar、VPicker、VPopup、VSearch、VSwiper、VTabbar、VTabs。",
"notes": "VUI Mobile 组件语义索引,面向移动端 H5,底层基于 Vant 4。当前覆盖 VButton、VCell、VDropdownMenu、VDropdownItem、VField、VImage、VList、VNavBar、VPicker、VPopup、VSearch、VSection、VSwiper、VTabbar、VTabs。",
"components": [
{
"exportName": "VButton",
......@@ -11,11 +11,6 @@
"source": "src/components/VButton/VButton.vue"
},
{
"exportName": "VCard",
"manifest": "src/components/VCard/VCard.manifest.json",
"source": "src/components/VCard/VCard.vue"
},
{
"exportName": "VCell",
"manifest": "src/components/VCell/VCell.manifest.json",
"source": "src/components/VCell/VCell.vue"
......@@ -66,6 +61,11 @@
"source": "src/components/VSearch/VSearch.vue"
},
{
"exportName": "VSection",
"manifest": "src/components/VSection/VSection.manifest.json",
"source": "src/components/VSection/VSection.vue"
},
{
"exportName": "VSwiper",
"manifest": "src/components/VSwiper/VSwiper.manifest.json",
"source": "src/components/VSwiper/VSwiper.vue"
......
{
"$schema": "../../../../../../contracts/ai/component-manifest-item.schema.json",
"name": "section",
"exportName": "VSection",
"source": "src/components/VSection/VSection.vue",
"category": "display",
"description": "移动端分段容器组件,基于 Vant 4 Card。用于包裹页面中的独立内容区块(车辆详情、检测报告、图片画廊、车辆描述等),提供白色圆角卡片样式。通过 full 属性可通栏展示,通过 default/header/footer 插槽自定义内容。适用于任何需要独立容器包裹的内容区块。",
"semanticRoles": ["section", "info-panel", "section-container", "content-block", "page-section"],
"supportedKinds": ["SECTION", "SECTION_CONTAINER", "CONTENT_BLOCK", "CARD"],
"supportedScopes": ["list", "section"],
"priority": 5,
"props": [
{ "name": "title", "type": "string", "description": "标题。" },
{ "name": "desc", "type": "string", "description": "描述。" },
{ "name": "thumb", "type": "string", "description": "左侧图片 URL。" },
{ "name": "thumbLink", "type": "string", "description": "点击缩略图的跳转链接。" },
{ "name": "price", "type": "number | string", "description": "商品价格。" },
{ "name": "num", "type": "number | string", "description": "商品数量。" },
{ "name": "originPrice", "type": "number | string", "description": "商品原价,显示为划线价。" },
{ "name": "currency", "type": "string", "description": "货币符号。", "default": "'¥'" },
{ "name": "tag", "type": "string", "description": "图片左上角标签文字。" },
{ "name": "centered", "type": "boolean", "description": "是否垂直居中布局。", "default": "false" },
{ "name": "full", "type": "boolean", "description": "是否通栏卡片(无边距圆角)。", "default": "false" }
],
"events": [
{ "name": "click", "description": "卡片点击事件。", "payload": "MouseEvent" },
{ "name": "clickThumb", "description": "缩略图点击事件。" }
],
"slots": [
{ "name": "default", "description": "卡片内容区域。" },
{ "name": "title", "description": "自定义标题。" },
{ "name": "desc", "description": "自定义描述。" },
{ "name": "price", "description": "自定义价格。" },
{ "name": "price-top", "description": "价格上方自定义内容。" },
{ "name": "bottom", "description": "价格下方自定义内容。" },
{ "name": "thumb", "description": "自定义缩略图。" },
{ "name": "tag", "description": "自定义标签。" },
{ "name": "footer", "description": "底部操作区域。" },
{ "name": "header", "description": "顶部自定义内容。" },
{ "name": "tags", "description": "描述下方标签区域。" }
],
"figmaMapping": {
"keywords": ["section", "container", "区块", "分段", "面板", "内容块", "白色背景块", "圆角容器", "车辆详情区块", "检测报告区块", "图片画廊区块", "车辆描述区块"],
"nodeTypes": ["FRAME", "COMPONENT", "INSTANCE"],
"variantHints": ["section", "full", "header", "footer", "content"]
},
"usageGuidance": {
"recommendedScenarios": ["页面中的独立内容区块", "车辆详情分段", "检测报告分段", "图片画廊分段", "车辆描述分段", "白色圆角信息区块", "任何需要独立容器包裹的内容区块"],
"avoidScenarios": ["纯文本信息展示(用 VCell)", "复杂表单容器", "全屏页面级容器", "商品列表项(用 VCard)"],
"dependencies": ["vant"]
}
}
<template>
<van-card
class="vui-section"
:class="{
'vui-section--centered': centered,
'vui-section--full': full,
}"
:title="title"
:desc="desc"
:thumb="thumb"
:price="price"
:num="num"
:origin-price="originPrice"
:tag="tag"
:currency="currency"
:thumb-link="thumbLink"
v-bind="$attrs"
@click="handleClick"
@click-thumb="handleClickThumb"
>
<template v-if="$slots.tag || tag" #tag>
<slot name="tag">
{{ tag }}
</slot>
</template>
<template v-if="$slots.title" #title>
<slot name="title" />
</template>
<template v-if="$slots.desc" #desc>
<slot name="desc" />
</template>
<template v-if="$slots.price" #price>
<slot name="price" />
</template>
<template v-if="$slots['price-top']" #price-top>
<slot name="price-top" />
</template>
<template v-if="$slots['bottom']" #bottom>
<slot name="bottom" />
</template>
<template v-if="$slots['thumb']" #thumb>
<slot name="thumb" />
</template>
<template v-if="$slots.footer" #footer>
<slot name="footer" />
</template>
<template v-if="$slots.header" #header>
<slot name="header" />
</template>
<template v-if="$slots.tags" #tags>
<slot name="tags" />
</template>
<slot />
</van-card>
</template>
<script setup lang="ts">
import { Card as vanCard } from "vant";
defineOptions({ name: "VSection" });
defineProps<{
centered?: boolean;
currency?: string;
desc?: string;
full?: boolean;
num?: number | string;
originPrice?: number | string;
price?: number | string;
tag?: string;
thumb?: string;
thumbLink?: string;
title?: string;
}>();
const emit = defineEmits<{
(event: "click", value: MouseEvent): void;
(event: "clickThumb"): void;
}>();
function handleClick(event: MouseEvent) {
emit("click", event);
}
function handleClickThumb() {
emit("clickThumb");
}
</script>
<style scoped>
.vui-card--centered {
display: flex;
align-items: center;
}
.vui-card--full {
margin: 0;
border-radius: 0;
}
</style>
import type { DefineComponent } from "vue";
declare const VSection: DefineComponent<{
centered?: boolean;
currency?: string;
desc?: string;
full?: boolean;
num?: number | string;
originPrice?: number | string;
price?: number | string;
tag?: string;
thumb?: string;
thumbLink?: string;
title?: string;
}>;
export default VSection;
export { default } from "./VSection.vue";
......@@ -10,7 +10,7 @@
"supportedScopes": ["page", "section"],
"priority": 5,
"props": [
{ "name": "items", "type": "TabItem[]", "description": "标签页数据,每项包含 title、name、content、disabled 等。" },
{ "name": "items", "type": "TabItem[]", "description": "标签页数据数组。每项结构:{ title: string (必填,标签文字), name?: string | number (标识符), content?: string (标签内容), disabled?: boolean, badge?: string | number, dot?: boolean }。例:[{ title: '外观', name: 'exterior' }, { title: '内饰', name: 'interior' }]" },
{ "name": "modelValue", "type": "number | string", "description": "当前激活的标签 name 或 index。" },
{ "name": "type", "type": "'line' | 'card'", "description": "标签样式类型。", "default": "'line'" },
{ "name": "color", "type": "string", "description": "标签主题色。" },
......
export { default as VButton } from "./VButton";
export { default as VCard } from "./VCard";
export { default as VCell } from "./VCell";
export { default as VDropdownItem } from "./VDropdownItem";
export { default as VDropdownMenu } from "./VDropdownMenu";
......@@ -10,6 +9,7 @@ export { default as VNavBar } from "./VNavBar";
export { default as VPicker } from "./VPicker";
export { default as VPopup } from "./VPopup";
export { default as VSearch } from "./VSearch";
export { default as VSection } from "./VSection";
export { default as VSwiper } from "./VSwiper";
export { default as VTabbar } from "./VTabbar";
export { default as VTabs } from "./VTabs";
......@@ -135,6 +135,11 @@ function parseCliArgs() {
break;
}
case "--no-skip-validate": {
parsed.skipValidate = false;
break;
}
case "--refresh-context": {
parsed.refreshContext = true;
......
......@@ -779,12 +779,27 @@ function buildPromptBundleSnapshot(bundle) {
const vuiComponentSignatures = (bundle.componentFacts?.vuiCatalog?.components || []).map((component) => ({
exportName: component.exportName,
description: component.description || "",
semanticRoles: component.semanticRoles || [],
supportedKinds: component.supportedKinds || [],
priority: component.priority,
props: (component.props || []).map((prop) => ({
name: prop.name,
type: prop.type,
description: prop.description || undefined,
default: prop.default,
})),
events: (component.events || []).map((event) => event.name),
slots: (component.slots || []).map((slot) => slot.name),
events: (component.events || []).map((event) => ({
name: event.name,
description: event.description || undefined,
payload: event.payload || undefined,
})),
slots: (component.slots || []).map((slot) => ({
name: slot.name,
description: slot.description || undefined,
scope: slot.scope || undefined,
})),
figmaMapping: component.figmaMapping || undefined,
usageGuidance: component.usageGuidance || undefined,
}));
return {
......
......@@ -20,7 +20,7 @@
"cliTemplate": "mobile",
"cliUiOption": "vant",
"componentHints": [
"第一顺位使用 @vui/mobile 组件:VButton、VCard、VCell、VDropdownMenu、VDropdownItem、VField、VImage、VList、VNavBar、VPicker、VPopup、VSearch、VSwiper、VTabbar、VTabs",
"第一顺位使用 @vui/mobile 组件:VButton、VCell、VDropdownMenu、VDropdownItem、VField、VImage、VList、VNavBar、VPicker、VPopup、VSearch、VSection、VSwiper、VTabbar、VTabs",
"若 @vui/mobile 未覆盖当前场景,降级到 Vant 4 原生组件(van-field、van-picker、van-cell 等)",
"Vant 4 基于 Vue 3 + TypeScript,组件使用 kebab-case 前缀 van-",
"第三顺位使用 HTML 原生组件",
......
......@@ -147,6 +147,7 @@ function buildBatchArgs(config, figmaUrls, repoRoot) {
);
if (config.force !== false) args.push("--force");
if (config.skipPreview) args.push("--skip-preview");
if (config.skipValidate) args.push("--skip-validate");
if (config.targetPlatform?.trim()) args.push("--target-platform", config.targetPlatform.trim());
if (config.fallbackUi?.trim()) args.push("--fallback-ui", config.fallbackUi.trim());
......@@ -416,6 +417,7 @@ async function runBatchGeneration(batch, bIndex, isLastBatch, config, repoRoot,
if (config.targetPlatform?.trim()) args.push("--target-platform", config.targetPlatform.trim());
if (config.fallbackUi?.trim()) args.push("--fallback-ui", config.fallbackUi.trim());
if (config.skipScreenshotSummary) args.push("--skip-screenshot-summary");
if (config.skipValidate) args.push("--skip-validate");
if (config.skipGovernance) args.push("--skip-governance");
log(`${batchLabel} 命令: node ${args.join(" ")}`);
......@@ -543,6 +545,10 @@ async function runSingleUrl(config, figmaUrl, env, repoRoot, log) {
args.push("--skip-screenshot-summary");
log("跳过截图视觉摘要");
}
if (config.skipValidate) {
args.push("--skip-validate");
log("跳过代码验证和自动修复");
}
if (config.skipGovernance) {
args.push("--skip-governance");
log("跳过 Venus 治理检查");
......
......@@ -138,6 +138,10 @@
<label>跳过截图视觉摘要(节省 5-15 秒)</label>
</div>
<div class="checkbox-row">
<input type="checkbox" id="skipValidate" checked>
<label>跳过代码验证和自动修复(节省时间)</label>
</div>
<div class="checkbox-row">
<input type="checkbox" id="enableGovernance" checked>
<label>启用 Venus 治理(fitness 质检、健康检查、文件大小检测等)</label>
</div>
......
......@@ -381,6 +381,7 @@ function startGenerate() {
refreshContext: document.querySelector("#refreshContext").checked,
skipPreview: document.querySelector("#skipPreview").checked,
skipScreenshotSummary: document.querySelector("#skipScreenshotSummary").checked,
skipValidate: document.querySelector("#skipValidate").checked,
skipGovernance: !document.querySelector("#enableGovernance").checked,
targetPlatform: document.querySelector("#targetPlatform").value.trim(),
fallbackUi: document.querySelector("#fallbackUi").value.trim(),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!