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('/index', '') : '';
|
||||
let search = '';
|
||||
for (const k in options) {
|
||||
if (search) {
|
||||
search += '&';
|
||||
}
|
||||
search += `${k}=${ typeof options[k] === 'string' ? options[k] : JSON.stringify(options[k])}`;
|
||||
}
|
||||
return {
|
||||
pathname: pathname,
|
||||
state: options,
|
||||
key: `${pages.length - 1}`,
|
||||
namespace: this.namespace,
|
||||
search,
|
||||
};
|
||||
}
|
||||
getState() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ type Location = {
|
|||
state?: Record<string, any>;
|
||||
key: string;
|
||||
namespace: string;
|
||||
search: string;
|
||||
};
|
||||
|
||||
export class Navigator extends CommonNavigator {
|
||||
|
|
@ -29,11 +30,19 @@ export class Navigator extends CommonNavigator {
|
|||
.replace('/pages', '')
|
||||
.replace('pages', '')
|
||||
.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 {
|
||||
pathname: pathname,
|
||||
state: options,
|
||||
key: `${pages.length - 1}`,
|
||||
namespace: this.namespace,
|
||||
search,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue