Commit f4fa4e6c by pangchong

style(compareModal): 优化模板格式与调试日志格式化

- 调整 CompareModal 组件中 diffCounts 显示的 template 代码格式,提升代码可读性
- 优化比对功能中调试日志打印的格式化结构,使输出信息更清晰易读
- 保持了原有逻辑与功能不变,仅改进代码样式与日志表现
parent dd486f2f
...@@ -1267,22 +1267,32 @@ export function useCompareModal() { ...@@ -1267,22 +1267,32 @@ export function useCompareModal() {
// 查找并高亮左侧与右侧排版区域中匹配的元素 // 查找并高亮左侧与右侧排版区域中匹配的元素
const targetLeft = leftRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement const targetLeft = leftRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement
console.log('[DEBUG Compare] targetLeft element:', targetLeft ? { console.log(
tagName: targetLeft.tagName, '[DEBUG Compare] targetLeft element:',
nodeIdAttr: targetLeft.getAttribute('data-node-id'), targetLeft
outerHTML: targetLeft.outerHTML.slice(0, 200) ? {
} : 'null') tagName: targetLeft.tagName,
nodeIdAttr: targetLeft.getAttribute('data-node-id'),
outerHTML: targetLeft.outerHTML.slice(0, 200)
}
: 'null'
)
if (targetLeft) { if (targetLeft) {
targetLeft.classList.add('render-active-highlight') targetLeft.classList.add('render-active-highlight')
} }
const targetRight = rightRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement const targetRight = rightRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement
console.log('[DEBUG Compare] targetRight element:', targetRight ? { console.log(
tagName: targetRight.tagName, '[DEBUG Compare] targetRight element:',
nodeIdAttr: targetRight.getAttribute('data-node-id'), targetRight
outerHTML: targetRight.outerHTML.slice(0, 200) ? {
} : 'null') tagName: targetRight.tagName,
nodeIdAttr: targetRight.getAttribute('data-node-id'),
outerHTML: targetRight.outerHTML.slice(0, 200)
}
: 'null'
)
if (targetRight) { if (targetRight) {
targetRight.classList.add('render-active-highlight') targetRight.classList.add('render-active-highlight')
......
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
+ +
</span> </span>
<span class="text-success font-medium">新增内容</span> <span class="text-success font-medium">新增内容</span>
<span v-if="compared" class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-success/10 border border-success/30 text-success leading-none"> <span
v-if="compared"
class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-success/10 border border-success/30 text-success leading-none"
>
{{ diffCounts.added }} {{ diffCounts.added }}
</span> </span>
</div> </div>
...@@ -33,7 +36,10 @@ ...@@ -33,7 +36,10 @@
- -
</span> </span>
<span class="text-error font-medium line-through">删除内容</span> <span class="text-error font-medium line-through">删除内容</span>
<span v-if="compared" class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-error/10 border border-error/30 text-error leading-none"> <span
v-if="compared"
class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-error/10 border border-error/30 text-error leading-none"
>
{{ diffCounts.removed }} {{ diffCounts.removed }}
</span> </span>
</div> </div>
...@@ -44,7 +50,10 @@ ...@@ -44,7 +50,10 @@
~ ~
</span> </span>
<span class="text-warning font-medium">属性/文本变更</span> <span class="text-warning font-medium">属性/文本变更</span>
<span v-if="compared" class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-warning/10 border border-warning/30 text-warning leading-none"> <span
v-if="compared"
class="px-1.5 py-0.5 text-[10px] font-bold rounded bg-warning/10 border border-warning/30 text-warning leading-none"
>
{{ diffCounts.modified }} {{ diffCounts.modified }}
</span> </span>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment