File tree Expand file tree Collapse file tree 4 files changed +504
-145
lines changed Expand file tree Collapse file tree 4 files changed +504
-145
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type { Route } from './types';
3
3
/**
4
4
* 判断是否是同一个路由
5
5
*/
6
- export function isSameRoute ( from : Route , to : Route ) {
6
+ export function isSameRoute ( to : Route , from : Route ) {
7
7
return (
8
8
from . matched . length === to . matched . length &&
9
9
from . matched . every ( ( record , i ) => record === to . matched [ i ] )
@@ -13,7 +13,7 @@ export function isSameRoute(from: Route, to: Route) {
13
13
/**
14
14
* 判断是否是全等的路由: 路径完全相同
15
15
*/
16
- export function isEqualRoute ( from : Route , to : Route ) {
16
+ export function isEqualRoute ( to : Route , from : Route ) {
17
17
return (
18
18
// 这里不仅仅判断了前后的path是否一致
19
19
// 同时判断了匹配路由对象的个数
Original file line number Diff line number Diff line change @@ -133,15 +133,6 @@ export function createRoute(
133
133
export function createRouteByURL ( loc : URL ) : Route {
134
134
return {
135
135
loc : loc ,
136
- hash : loc . hash ,
137
- host : loc . host ,
138
- hostname : loc . hostname ,
139
- href : loc . href ,
140
- origin : loc . origin ,
141
- pathname : loc . pathname ,
142
- port : loc . port ,
143
- protocol : loc . protocol ,
144
- search : loc . search ,
145
136
params : { } ,
146
137
query : { } ,
147
138
queryArray : { } ,
Original file line number Diff line number Diff line change @@ -6,16 +6,16 @@ import type {
6
6
NavigationResult ,
7
7
Route ,
8
8
RouteState ,
9
- RouterMicroApp ,
10
9
RouterMicroAppCallback ,
10
+ RouterMicroAppOptions ,
11
11
RouterOptions ,
12
12
RouterParsedOptions ,
13
13
RouterRawLocation
14
14
} from './types' ;
15
15
import { isBrowser } from './util' ;
16
16
17
17
class MicroApp {
18
- public app : RouterMicroApp | null = null ;
18
+ public app : RouterMicroAppOptions | null = null ;
19
19
private _factory : RouterMicroAppCallback | null = null ;
20
20
public _update ( router : Router ) {
21
21
const factory = this . _getNextFactory ( router ) ;
@@ -191,7 +191,7 @@ export class Router {
191
191
return handleRoute ( {
192
192
navType,
193
193
options : this . options ,
194
- loc : loc ?? this . route . href ,
194
+ loc : loc ?? this . route . loc . href ,
195
195
handle : async ( result ) => {
196
196
await this . _applyRoute ( result . route ) ;
197
197
return result ;
You can’t perform that action at this time.
0 commit comments