File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 11import { noop } from '../../util/core' ;
22import { on } from '../../util/dom' ;
3- import { parseQuery , cleanPath , replaceSlug } from '../util' ;
3+ import { parseQuery , cleanPath , replaceSlug , endsWith } from '../util' ;
44import { History } from './base' ;
55
66function replaceHash ( path ) {
77 const i = location . href . indexOf ( '#' ) ;
88 location . replace ( location . href . slice ( 0 , i >= 0 ? i : 0 ) + '#' + path ) ;
99}
10-
11- function endsWith ( str , suffix ) {
12- return str . indexOf ( suffix , str . length - suffix . length ) !== - 1 ;
13- }
14-
1510export class HashHistory extends History {
1611 constructor ( config ) {
1712 super ( config ) ;
Original file line number Diff line number Diff line change @@ -113,3 +113,7 @@ export function getPath(...args) {
113113export const replaceSlug = cached ( path => {
114114 return path . replace ( '#' , '?id=' ) ;
115115} ) ;
116+
117+ export function endsWith ( str , suffix ) {
118+ return str . indexOf ( suffix , str . length - suffix . length ) !== - 1 ;
119+ }
You can’t perform that action at this time.
0 commit comments