Commit 93c18625 authored by jz's avatar jz

修改参数传值问题

parent cc844709
...@@ -53,15 +53,33 @@ ...@@ -53,15 +53,33 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) { if (indexPath.row == 0) {
[[GMRouter sharedInstance] pushScheme:@"common"]; [[GMRouter sharedInstance] pushScheme:@"common?title=无极&name=杨二&age=10"];
} else if (indexPath.row == 1) { } else if (indexPath.row == 1) {
[[GMRouter sharedInstance] pushScheme:@"common" completeBlock:NULL]; [[GMRouter sharedInstance] pushScheme:@"common?title=无极&name=杨二&age=10" completeBlock:NULL];
} else if (indexPath.row == 2) { } else if (indexPath.row == 2) {
[[GMRouter sharedInstance] pushScheme:@"common" params:@{} completeBlock:^(NSDictionary * _Nonnull params) { [[GMRouter sharedInstance] pushScheme:@"common" params:@{
@"title": @"无极",
@"age":@10
} completeBlock:^(NSDictionary * _Nonnull params) {
NSLog(@"收到回调"); NSLog(@"收到回调");
}]; }];
} }
// 2020-08-13 17:20:43.820434+0800 GMRouter_Example[79040:1881736] params===={
// age = 10;
// name = "\U6768\U4e8c";
// title = "\U65e0\U6781";
// }======
// 2020-08-13 17:20:53.186791+0800 GMRouter_Example[79040:1881736] params===={
// age = 10;
// name = "\U6768\U4e8c";
// title = "\U65e0\U6781";
// }======
// 2020-08-13 17:21:02.304938+0800 GMRouter_Example[79040:1881736] params===={
// age = 10;
// title = "\U65e0\U6781";
// }======
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
@implementation Target_Common @implementation Target_Common
- (UIViewController *)common:(NSDictionary *)params { - (UIViewController *)common:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init]; GMViewController *vc = [[GMViewController alloc] init];
NSLog(@"params====%@======", params);
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES]; [[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc; return vc;
} }
......
...@@ -51,7 +51,7 @@ static NSMutableDictionary *routeMap = nil; ...@@ -51,7 +51,7 @@ static NSMutableDictionary *routeMap = nil;
NSMutableDictionary *allParams = [NSMutableDictionary dictionaryWithDictionary:params]; NSMutableDictionary *allParams = [NSMutableDictionary dictionaryWithDictionary:params];
NSString *encodeUrlScheme = [self URLEncodeString:urlScheme]; NSString *encodeUrlScheme = [self URLEncodeString:urlScheme];
NSString *host = [self getHost:urlScheme]; NSString *host = [self getHost:encodeUrlScheme];
NSString *targetName = [routeMap objectForKey:host]; NSString *targetName = [routeMap objectForKey:host];
NSDictionary *paramsDict = [self getParams:encodeUrlScheme]; NSDictionary *paramsDict = [self getParams:encodeUrlScheme];
[allParams addEntriesFromDictionary:paramsDict]; [allParams addEntriesFromDictionary:paramsDict];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment