vue-i18n-routing
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -631,2 +631,20 @@ var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
} | ||
function isV4Route(val) { | ||
return vueDemi.isVue3; | ||
} | ||
function resolveBridgeRoute(val) { | ||
return isV4Route() ? val : val.route; | ||
} | ||
function resolvedRouteToObject(route) { | ||
const r = resolveBridgeRoute(route); | ||
const encodedPath = encodeURI(r.path); | ||
const queryString = r.fullPath.indexOf("?") >= 0 ? r.fullPath.substring(r.fullPath.indexOf("?")) : ""; | ||
const resolvedObject = { | ||
...r, | ||
fullPath: encodedPath + queryString, | ||
path: encodedPath, | ||
href: encodedPath + queryString | ||
}; | ||
return vueDemi.isVue3 ? resolvedObject : { ...route, route: resolvedObject }; | ||
} | ||
function resolve(router, route, strategy, locale) { | ||
@@ -744,4 +762,4 @@ if (vueDemi.isVue3 && strategy === "prefix") { | ||
try { | ||
const resolvedRoute = router.resolve(localizedRoute); | ||
if (vueDemi.isVue3 ? resolvedRoute.name : resolvedRoute.route.name) { | ||
const resolvedRoute = resolvedRouteToObject(router.resolve(localizedRoute)); | ||
if (isV4Route(resolvedRoute) ? resolvedRoute.name : resolvedRoute.route.name) { | ||
return resolvedRoute; | ||
@@ -1142,3 +1160,3 @@ } | ||
} | ||
const VERSION = "1.1.1"; | ||
const VERSION = "1.1.2"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1145,0 +1163,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -634,2 +634,20 @@ "use strict"; | ||
} | ||
function isV4Route(val) { | ||
return vueDemi.isVue3; | ||
} | ||
function resolveBridgeRoute(val) { | ||
return isV4Route() ? val : val.route; | ||
} | ||
function resolvedRouteToObject(route) { | ||
const r = resolveBridgeRoute(route); | ||
const encodedPath = encodeURI(r.path); | ||
const queryString = r.fullPath.indexOf("?") >= 0 ? r.fullPath.substring(r.fullPath.indexOf("?")) : ""; | ||
const resolvedObject = { | ||
...r, | ||
fullPath: encodedPath + queryString, | ||
path: encodedPath, | ||
href: encodedPath + queryString | ||
}; | ||
return vueDemi.isVue3 ? resolvedObject : { ...route, route: resolvedObject }; | ||
} | ||
function resolve(router, route, strategy, locale) { | ||
@@ -747,4 +765,4 @@ if (vueDemi.isVue3 && strategy === "prefix") { | ||
try { | ||
const resolvedRoute = router.resolve(localizedRoute); | ||
if (vueDemi.isVue3 ? resolvedRoute.name : resolvedRoute.route.name) { | ||
const resolvedRoute = resolvedRouteToObject(router.resolve(localizedRoute)); | ||
if (isV4Route(resolvedRoute) ? resolvedRoute.name : resolvedRoute.route.name) { | ||
return resolvedRoute; | ||
@@ -1145,3 +1163,3 @@ } | ||
} | ||
const VERSION = "1.1.1"; | ||
const VERSION = "1.1.2"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1148,0 +1166,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"scripts": { | ||
@@ -35,3 +35,3 @@ "dev": "vite", | ||
"vue-router": "^4.1.5", | ||
"vue-router3": "npm:vue-router@3.5.4", | ||
"vue-router3": "npm:vue-router@3.6.5", | ||
"vue-template-compiler": "^2.6.14", | ||
@@ -38,0 +38,0 @@ "vue2": "npm:vue@2.6.14" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166684
4592