getLocation方法中返回search
This commit is contained in:
parent
98d9ce36d0
commit
feaf8c9b87
|
|
@ -16,11 +16,19 @@ export class Navigator extends CommonNavigator {
|
||||||
.replace('/pages', '')
|
.replace('/pages', '')
|
||||||
.replace('pages', '')
|
.replace('pages', '')
|
||||||
.replace('/index', '') : '';
|
.replace('/index', '') : '';
|
||||||
|
let search = '';
|
||||||
|
for (const k in options) {
|
||||||
|
if (search) {
|
||||||
|
search += '&';
|
||||||
|
}
|
||||||
|
search += `${k}=${ typeof options[k] === 'string' ? options[k] : JSON.stringify(options[k])}`;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
pathname: pathname,
|
pathname: pathname,
|
||||||
state: options,
|
state: options,
|
||||||
key: `${pages.length - 1}`,
|
key: `${pages.length - 1}`,
|
||||||
namespace: this.namespace,
|
namespace: this.namespace,
|
||||||
|
search,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
getState() {
|
getState() {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ type Location = {
|
||||||
state?: Record<string, any>;
|
state?: Record<string, any>;
|
||||||
key: string;
|
key: string;
|
||||||
namespace: string;
|
namespace: string;
|
||||||
|
search: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Navigator extends CommonNavigator {
|
export class Navigator extends CommonNavigator {
|
||||||
|
|
@ -29,11 +30,19 @@ export class Navigator extends CommonNavigator {
|
||||||
.replace('/pages', '')
|
.replace('/pages', '')
|
||||||
.replace('pages', '')
|
.replace('pages', '')
|
||||||
.replace('/index', '') : '';
|
.replace('/index', '') : '';
|
||||||
|
let search = '';
|
||||||
|
for (const k in options) {
|
||||||
|
if (search) {
|
||||||
|
search += '&';
|
||||||
|
}
|
||||||
|
search += `${k}=${ typeof options[k] === 'string' ? options[k] : JSON.stringify(options[k])}`;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
pathname: pathname,
|
pathname: pathname,
|
||||||
state: options,
|
state: options,
|
||||||
key: `${pages.length - 1}`,
|
key: `${pages.length - 1}`,
|
||||||
namespace: this.namespace,
|
namespace: this.namespace,
|
||||||
|
search,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue