Showing
3 changed files
with
34 additions
and
2 deletions
| ... | @@ -5,6 +5,21 @@ | ... | @@ -5,6 +5,21 @@ |
| 5 | 5 | ||
| 6 | --- | 6 | --- |
| 7 | 7 | ||
| 8 | +## [2026-02-06] - 修复搜索栏清空按钮点击无效 | ||
| 9 | + | ||
| 10 | +### 修复 | ||
| 11 | +- 修复计划书页面搜索框清空按钮点击无响应的问题 | ||
| 12 | +- SearchBar 组件添加 `.stop` 修饰符阻止事件冒泡 | ||
| 13 | +- 增强 `handleClear` 函数,显式调用 `stopPropagation()` | ||
| 14 | +- 添加 `emit('input', '')` 保持事件一致性 | ||
| 15 | +- 计划书页面添加显式 `searchValue` 重置 | ||
| 16 | + | ||
| 17 | +--- | ||
| 18 | + | ||
| 19 | +> 格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/), | ||
| 20 | + | ||
| 21 | +--- | ||
| 22 | + | ||
| 8 | ## [2026-02-06] - 修复计划书页面触底加载更多不触发 | 23 | ## [2026-02-06] - 修复计划书页面触底加载更多不触发 |
| 9 | 24 | ||
| 10 | ### 修复 | 25 | ### 修复 | ... | ... |
| ... | @@ -27,7 +27,8 @@ | ... | @@ -27,7 +27,8 @@ |
| 27 | <view | 27 | <view |
| 28 | v-if="showClear && internalValue" | 28 | v-if="showClear && internalValue" |
| 29 | class="clear-icon" | 29 | class="clear-icon" |
| 30 | - @tap="handleClear" | 30 | + @tap.stop="handleClear" |
| 31 | + @click.stop="handleClear" | ||
| 31 | > | 32 | > |
| 32 | <IconFont | 33 | <IconFont |
| 33 | name="close" | 34 | name="close" |
| ... | @@ -236,11 +237,20 @@ function handleSearch() { | ... | @@ -236,11 +237,20 @@ function handleSearch() { |
| 236 | /** | 237 | /** |
| 237 | * 清除输入 | 238 | * 清除输入 |
| 238 | */ | 239 | */ |
| 239 | -function handleClear() { | 240 | +function handleClear(event) { |
| 240 | console.log('[SearchBar Component] 清除输入') | 241 | console.log('[SearchBar Component] 清除输入') |
| 242 | + // 阻止事件冒泡 | ||
| 243 | + if (event) { | ||
| 244 | + event.stopPropagation() | ||
| 245 | + } | ||
| 246 | + // 清空内部值 | ||
| 241 | internalValue.value = '' | 247 | internalValue.value = '' |
| 248 | + // 触发 clear 事件(通知父组件) | ||
| 242 | emit('clear') | 249 | emit('clear') |
| 250 | + // 触发 v-model 更新 | ||
| 243 | emit('update:modelValue', '') | 251 | emit('update:modelValue', '') |
| 252 | + // 触发 input 事件(保持一致性) | ||
| 253 | + emit('input', '') | ||
| 244 | } | 254 | } |
| 245 | 255 | ||
| 246 | /** | 256 | /** | ... | ... |
| ... | @@ -596,6 +596,11 @@ const onSearch = () => { | ... | @@ -596,6 +596,11 @@ const onSearch = () => { |
| 596 | * 清空搜索 | 596 | * 清空搜索 |
| 597 | */ | 597 | */ |
| 598 | const onClear = () => { | 598 | const onClear = () => { |
| 599 | + console.log('[Plan Page] onClear 被调用') | ||
| 600 | + | ||
| 601 | + // 清空搜索值 | ||
| 602 | + searchValue.value = '' | ||
| 603 | + | ||
| 599 | // 重置分页状态 | 604 | // 重置分页状态 |
| 600 | currentPage.value = 0 | 605 | currentPage.value = 0 |
| 601 | hasMore.value = true | 606 | hasMore.value = true |
| ... | @@ -604,6 +609,8 @@ const onClear = () => { | ... | @@ -604,6 +609,8 @@ const onClear = () => { |
| 604 | 609 | ||
| 605 | // 重新加载数据 | 610 | // 重新加载数据 |
| 606 | fetchPlanList(0, pageSize, false) | 611 | fetchPlanList(0, pageSize, false) |
| 612 | + | ||
| 613 | + console.log('[Plan Page] onClear 完成,列表已刷新') | ||
| 607 | } | 614 | } |
| 608 | 615 | ||
| 609 | /** | 616 | /** | ... | ... |
-
Please register or login to post a comment