-import { warn } from 'vue'
+import { warn } from './warning'
/**
* Encoding Rules ␣ = Space Path: ␣ " < > # ? { } Query: ␣ " < > # & = Hash: ␣ "
computeScrollPosition,
ScrollPositionCoordinates,
} from '../scrollBehavior'
-import { warn } from 'vue'
+import { warn } from '../warning'
import { stripBase } from '../location'
type PopStateListener = (this: Window, ev: PopStateEvent) => any
history[replace ? 'replaceState' : 'pushState'](state, '', url)
historyState.value = state
} catch (err) {
- warn('[vue-router]: Error with push/replace State', err)
+ warn('Error with push/replace State', err)
// Force the navigation, this also resets the call count
window.location[replace ? 'replace' : 'assign'](url)
}
PathParserOptions,
_PathParserOptions,
} from './pathParserRanker'
-import { warn } from 'vue'
+import { warn } from '../warning'
let noop = () => {}
parseQuery as originalParseQuery,
stringifyQuery as originalStringifyQuery,
} from './query'
-import { shallowRef, Ref, nextTick, App, warn } from 'vue'
+import { shallowRef, Ref, nextTick, App } from 'vue'
import { RouteRecord, RouteRecordNormalized } from './matcher/types'
import { parseURL, stringifyURL, isSameRouteLocation } from './location'
import { extractComponentsGuards, guardToPromiseFn } from './navigationGuards'
import { applyRouterPlugin } from './install'
+import { warn } from './warning'
/**
* Internal type to define an ErrorHandler
}
}
- // TODO: dev warning if params and path at the same time
-
// path could be relative in object as well
if ('path' in rawLocation) {
+ if (__DEV__ && 'params' in rawLocation) {
+ warn(
+ // @ts-ignore
+ `Path "${rawLocation.path}" was passed with params but they will be ignored. Use a named route instead or build the path yourself`
+ )
+ }
rawLocation = {
...rawLocation,
path: parseURL(parseQuery, rawLocation.path, currentLocation.path).path,
import { RouteLocationNormalized, RouteLocationNormalizedLoaded } from './types'
-import { warn } from 'vue'
+import { warn } from './warning'
export type ScrollPositionCoordinates = {
/**
--- /dev/null
+import { warn as vueWarn } from 'vue'
+
+const originalWarn = console.warn
+function customWarn(msg: string, ...args: any[]) {
+ originalWarn(msg.replace('Vue warn', 'Vue Router warn'), ...args)
+}
+
+export function warn(msg: string, ...args: any[]) {
+ console.warn = customWarn
+ vueWarn(msg, ...args)
+ console.warn = originalWarn
+}