refactor: use ternary

This commit is contained in:
julien huang 2023-07-30 21:59:51 +02:00
parent 2480983b2a
commit 88dfbcba65

View File

@ -63,13 +63,7 @@ function _getHashElementScrollMarginTop (selector: string): number {
}
function _isDifferentRoute (from: RouteLocationNormalized, to: RouteLocationNormalized): boolean {
const samePageComponent = to.path === from.path
const isSamePath = to.path === from.path
if (!samePageComponent) {
return true
}
if (samePageComponent && JSON.stringify(from.params) !== JSON.stringify(to.params)) {
return true
}
return false
return isSamePath ? JSON.stringify(from.params) !== JSON.stringify(to.params) : true
}