fix: hide smart split tags area when no valid fragments are parsed in scanner dialog

This commit is contained in:
DXC
2026-03-18 16:19:55 +08:00
parent 089a5b1c0f
commit 8c0a0340af

View File

@ -28,8 +28,8 @@
<div class="raw-text">{{ rawText }}</div>
</div>
<!-- 智能切割标签 -->
<div class="smart-tags">
<!-- 智能切割标签 - 仅当有多个有效片段时显示 -->
<div v-if="splitSegments.length > 1" class="smart-tags">
<div class="label">智能切割点击标签提取</div>
<div class="tags-container">
<el-tag
@ -162,8 +162,8 @@ const handleScanSuccess = (text: string) => {
}
const splitText = (text: string) => {
// 使用正则表达式智能切割
const segments = text.split(/[;,\s_\|:]+/).filter(s => s.trim().length > 0)
// 使用正则表达式智能切割,过滤空字符串
const segments = text.split(/[;,\s_\|:]+/).filter(s => s && s.trim().length > 0)
splitSegments.value = segments
if (segments.length > 0) {
selectedSegmentIndex.value = 0