Commit f4fa4e6c by pangchong

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

- 调整 CompareModal 组件中 diffCounts 显示的 template 代码格式,提升代码可读性
- 优化比对功能中调试日志打印的格式化结构,使输出信息更清晰易读
- 保持了原有逻辑与功能不变,仅改进代码样式与日志表现
parent dd486f2f
......@@ -1267,22 +1267,32 @@ export function useCompareModal() {
// 查找并高亮左侧与右侧排版区域中匹配的元素
const targetLeft = leftRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement
console.log('[DEBUG Compare] targetLeft element:', targetLeft ? {
console.log(
'[DEBUG Compare] targetLeft element:',
targetLeft
? {
tagName: targetLeft.tagName,
nodeIdAttr: targetLeft.getAttribute('data-node-id'),
outerHTML: targetLeft.outerHTML.slice(0, 200)
} : 'null')
}
: 'null'
)
if (targetLeft) {
targetLeft.classList.add('render-active-highlight')
}
const targetRight = rightRenderContainer.value?.querySelector(`[data-node-id^="${targetNodeId}"]`) as HTMLElement
console.log('[DEBUG Compare] targetRight element:', targetRight ? {
console.log(
'[DEBUG Compare] targetRight element:',
targetRight
? {
tagName: targetRight.tagName,
nodeIdAttr: targetRight.getAttribute('data-node-id'),
outerHTML: targetRight.outerHTML.slice(0, 200)
} : 'null')
}
: 'null'
)
if (targetRight) {
targetRight.classList.add('render-active-highlight')
......
......@@ -22,7 +22,10 @@
+
</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 }}
</span>
</div>
......@@ -33,7 +36,10 @@
-
</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 }}
</span>
</div>
......@@ -44,7 +50,10 @@
~
</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 }}
</span>
</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