vue3 h5端,当上个页面有for循环的标签并给标签加上ref引用时,在某些情况下,会导致下个页面离开时不会被正常销毁(附最小复现demo)
- Dominant language
- JavaScript
- Stars
- 41.6k
- Forks
- 3.7k
- Avg merge
- 7h 6m
- Merged PRs (30d)
- 6
Description
### 发行方式
H5
### 具体平台
edge135.0.3179.73
### 开发环境
Windows
### 项目创建方式
CLI命令行
### 依赖版本
3.0.0-4050720250324001
### 问题描述
ue3 h5端,当上个页面有for循环的标签并给标签加上ref引用时,在某些情况下,会导致下个页面离开时不会被正常销毁
### 重现步骤
1. 新建一个页面a,添加用for循环遍历的view标签,为view标签添加**ref**属性并在**setup**中定义
2. 调用**uni.redirectTo**跳转到页面b
3. 页面b调用**uni.redirectTo**跳转回页面a
### 期望行为
页面b被销毁,onUnmounted生命周期被调用
### 实际行为
页面b只是失活并调用了onDeactivated生命周期,并未被销毁,onUnmounted生命周期未被调用
### 截图或录屏
[复现demo](https://github.com/1SZX1/uni-bug-report.git)
Contributor guide
Research direction
Start with the minimal reproduction demo at https://github.com/1SZX1/uni-bug-report.git and follow the two-page uni.redirectTo flow described in this issue. Inspect how the ref on a v-for view affects page lifecycle handling on H5. Done means navigating from page b back to page a destroys page b and calls onUnmounted rather than only onDeactivated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100