-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
在route上面增加isEventChange属性判断是否是事件改变的路由还是调用方法改变的路由 #1916
Comments
Are you asking for a way to know if the action came from a user action or not? |
yes |
Sorry, I meant if the action came from clicking somewhere. |
only browser trigger router change should add this prop. because the vue-router handle the router event. i think it should be apply on |
Can you give some examples to better understand, please 🙂 ? |
IOS left slide backwhen you do a transition in router-view. you should judge the behavior is <template>
<div>
<h2>transition router-view</h2>
<transition :name="viewTransition" :css="!isEventChange">
<router-view />
</transition>
</div>
</template>
<script>
export default {
data () {
return {
viewTransition: 'forward',
isEventChange: false
}
}
}
</script> when you click the browser back navigator. you should do a back transition. but when you do left slide back using hand. you don't want to do transition in see example the code solution |
So, you only need to know if |
almost. i don't need know the direction. just want to know the router change is the |
But vue-router cannot guess if the action comes from a user action or not 🙁 |
of course vue-router can do it. wait a time. i will do a pr. |
If it's patching |
I just know the router change is by the user click browser navigator(include ios swipe back) or by router method execute (push, go, forward, back, replace, include router-link) |
这个问题有新进展了吗?@ @agileago |
同问,这个问题有进展了吗? |
Why not add the |
同问,这个问题有进展了吗? |
knowing if the action came from a user action or not is not doable in vue-router. Not even sure if it's possible in userland as well for all cases, but should be possible in specific scenarios |
What problem does this feature solve?
有时候需要知道是否是用户主动调用方法改变的路由还是点击导航栏或者左滑返回改变的路由,以处理动画效果,比如ios上面用户左滑返回上一个路由,需要在beforeEach里面判断是调用方法触发的还是
hashchange
或者popstate
事件触发的,来处理要不要拥有返回动画,如果是左滑返回的话就不用做动画效果了What does the proposed API look like?
The text was updated successfully, but these errors were encountered: