vue-router#RawLocation TypeScript Examples
The following examples show how to use
vue-router#RawLocation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: multistore.ts From vue-storefront-1 with MIT License | 6 votes |
export function localizedRoute (routeObj: LocalizedRoute | string | RouteConfig | RawLocation, storeCode: string = null): any {
if (!storeCode) {
storeCode = currentStoreView().storeCode
}
if (!routeObj) {
return routeObj
}
if ((typeof routeObj === 'object') && (routeObj as LocalizedRoute)) {
if ((routeObj as LocalizedRoute).fullPath && !(routeObj as LocalizedRoute).path) { // support both path and fullPath
routeObj['path'] = (routeObj as LocalizedRoute).fullPath
}
}
if (storeCode && config.defaultStoreCode !== storeCode && config.storeViews[storeCode] && config.storeViews[storeCode].appendStoreCode) {
if (typeof routeObj !== 'object') {
return localizedRoutePath(routeObj, storeCode)
}
return localizedRouteConfig(routeObj as RouteConfig, storeCode)
}
return routeObj
}
Example #2
Source File: storeCodeFromRoute.ts From vue-storefront-1 with MIT License | 6 votes |
storeCodeFromRoute = (matchedRouteOrUrl: LocalizedRoute | RawLocation | string): string => {
if (!matchedRouteOrUrl) return ''
for (let storeCode of config.storeViews.mapStoreUrlsFor) {
const store = config.storeViews[storeCode]
if (isMatchingByPath(matchedRouteOrUrl, store) || isMatchingByDomainAndPath(matchedRouteOrUrl, store)) {
return storeCode
}
}
return ''
}