-
-
Notifications
You must be signed in to change notification settings - Fork 5k
when nesting router-view component into transtion component throw bug: vm is undefined #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
请给重现(jsfiddle, codepen, etc), |
@fnlctrl 因为是多文件、又涉及到路由、 我不知道怎样把它们上传到 jsfiddle 这些网站上、所以我把项目打包上传到了我的github中了 https://github.com/jide123456/blog I upload project to my github https://github.com/jide123456/blog download or git clone it cmd run npm install and npm run dev browse project open browser call http://localhost:8080 will look below Index picture click red arrows title, look right side console panel, BUG reappear, such below picture |
我把问题定位了 当transition组件的mode是out-in时, beforRouteEnter钩子会在组件初次导航到时读取不到vm参数 |
不知道这是特性还是bug |
Probably the same issue as #648 |
@LinusBorg Thanks you :D . #648 I not long age looked. but I think them not same. my example very simple . it only use Transition and beforRouterEnter. (:з」∠) I'm not sure what the problem is the component compatibility or I wrote was wrong |
I started looking into this (with repo https://jsfiddle.net/u46tm6ay/4/), but haven't found the root cause. What I have so far: When a transition is running, these lines appearantly don't run: This leads to This only happens when we transition from one route to the other, not on the first visit of the first route (when there is no previous route to transition out of). Now the root of this must be in a combination of the transition component, the router-view component and the virtualDOM, resultinh in the parent element having ..or maybe I'm totally on the wrong track ^^ |
I have these files
app.vue
list.vue
such above code, I use beforeRouteEnter hook to fetch data, but runtime throw error : Uncaught (in promise) TypeError: Cannot set property 'list' of undefined(…)
I console.log(vm) discover vm is undefined
but, I nonuse transition component, the bug no throw such below code
app.vue
I want know how to use beforeRouteEnter hook meanwhile use transition component no throw the bug
Thanks very mush. forgive my engilsh is poor.
Chinese describe:
当我使用过度效果的时候我发现了一个问题, 那就是当过度组件和路由组件同时使用时(第一个app.vue),会导致 beforeRouteEnter 钩子中的vm参数无法正常获取(其值为undefined)、 导致我给实例赋值会产生抛出异常(list.vue)、
当我注释掉transition组件后恢复正常、
so、如果你知道这个问题怎么解决、快来告诉我吧、
非常感谢、
The text was updated successfully, but these errors were encountered: