fix: details

This commit is contained in:
2026-02-27 15:40:52 +08:00
parent 23d6d81532
commit 0e2f214552
5 changed files with 64 additions and 51 deletions
+29 -13
View File
@@ -13,8 +13,8 @@ interface DeckProps {
grid?: string;
gridW?: number;
gridH?: number;
bleed?: string;
padding?: string;
bleed?: number | string;
padding?: number | string;
fontSize?: number;
layers?: string;
fixed?: boolean | string;
@@ -27,8 +27,8 @@ customElement<DeckProps>('md-deck', {
grid: '',
gridW: 5,
gridH: 8,
bleed: '1',
padding: '2',
bleed: 1,
padding: 2,
fontSize: 3,
layers: '',
fixed: false
@@ -73,8 +73,19 @@ customElement<DeckProps>('md-deck', {
store.actions.setGridH(props.gridH ?? 8);
}
store.actions.setBleed(props.bleed || '1');
store.actions.setPadding(props.padding || '2');
// 解析 bleed 和 padding(支持旧字符串格式和新数字格式)
if (typeof props.bleed === 'string') {
store.actions.setBleed(Number(props.bleed));
} else {
store.actions.setBleed(props.bleed ?? 1);
}
if (typeof props.padding === 'string') {
store.actions.setPadding(Number(props.padding));
} else {
store.actions.setPadding(props.padding ?? 2);
}
store.actions.setFontSize(props.fontSize ?? 3);
// 加载 CSV 数据
@@ -88,12 +99,18 @@ customElement<DeckProps>('md-deck', {
return (
<div class="md-deck flex gap-4">
{/* 左侧:CSV 数据编辑 */}
{/*<Show when={store.state.isEditing && !store.state.fixed}>*/}
{/* <DataEditorPanel*/}
{/* activeTab={store.state.activeTab}*/}
{/* cards={store.state.cards}*/}
{/* updateCardData={store.actions.updateCardData}*/}
{/* />*/}
{/*</Show>*/}
<Show when={store.state.isEditing && !store.state.fixed}>
<DataEditorPanel
activeTab={store.state.activeTab}
cards={store.state.cards}
updateCardData={store.actions.updateCardData}
/>
<div class="flex-1">
<PropertiesEditorPanel store={store} />
</div>
</Show>
{/* 中间:卡牌预览和控制 */}
@@ -109,8 +126,7 @@ customElement<DeckProps>('md-deck', {
{/* 右侧:属性/图层编辑面板 */}
<Show when={store.state.isEditing && !store.state.fixed}>
<div class="flex gap-4">
<PropertiesEditorPanel store={store} />
<div class="flex-1">
<LayerEditorPanel store={store} />
</div>
</Show>