如若参数和路由均无变化,不需要调用 init,否则与 keep-alive 功能相矛盾了
Open
discussion
- Dominant language
- Vue
- Stars
- 16.3k
- Forks
- 4.7k
- PR merge metrics
- No merged PRs in 30d
Description
iview-admin 很好的处理了标签页切换而状态保持的问题,也提供了带参数页面的 demo,但实际项目中带参数的页面往往是有表单输入的,比如『编辑』页面,这时如果改动了输入框内容,而未保存时切换页签,会触发`$route`的`watch`或者`activated`中的`init()`,所以这里是否该加以判断,只有当路由及参数变化时才去触发 init 呢?否则对于表单页面 keep-alive 就无意义了。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the page components that use the $route watch or activated hook to call init(), then inspect how keep-alive handles tab changes. Reproduce the unsaved-form scenario and compare it with a route or parameter change. Done means init() is skipped when both are unchanged while still running when either changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100