Skip to content

Commit

Permalink
Merge pull request #12 from shiweifu/master
Browse files Browse the repository at this point in the history
修复了router block 传参无效的问题
  • Loading branch information
smhjsw committed Apr 29, 2015
2 parents dd982d2 + 0d24c57 commit db4cc63
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions HHRouter/HHRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ - (HHRouterBlock)matchBlock:(NSString*)route
{
NSDictionary* params = [self paramsInRoute:route];
HHRouterBlock routerBlock = [params[@"block"] copy];
HHRouterBlock returnBlock = ^id(NSDictionary* aParams)
{
HHRouterBlock returnBlock = ^id(NSDictionary* aParams) {
if (routerBlock) {
return routerBlock([params copy]);
}
return nil;
};
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:params];
[dic addEntriesFromDictionary:aParams];
return routerBlock([NSDictionary dictionaryWithDictionary:dic].copy);
}
return nil;
};

return [returnBlock copy];
return [returnBlock copy];
}

- (id)callBlock:(NSString*)route
Expand Down Expand Up @@ -247,4 +248,3 @@ - (NSDictionary*)params
}

@end

0 comments on commit db4cc63

Please sign in to comment.