一、组件之间的通讯 MKRouter
/* 注册 */
[[MKRouter sharedInstance] registerHandler:^(MKRouteRequest *request) {
// 跳转至商祥页
// request.callBack(nil, @{@"productId" : request[@"productId"]});
} forRoute:MKString(@".*product/detail.*\\?(.*)\\&(.*)$")];
/* 调用 */
[[MKRouter sharedInstance] handleURL:[NSURL URLWithString:@"weixin://com.apple.iphone/product/detail?productId=ID985632"] params:nil targetCallBack:^(NSError *error, NSDictionary *responseObject) {
}];
数据埋点: "appData/click?params={eventId:0925D6A034A58F06}"
商详跳转: "product/detail?productId=id1314785643"
二、页面跳转(推送、scheme、JSAPI-openURL)MKPageRouter
通过url正则匹配到相关的路由配置,生成对应类型的VC容器,从而实现页面跳转(url链接必须实现URL编解码)
native:通过plist配置,找到key对应VC容器的ClassName,或是在args中配置相关的映射规则
weex:获取weex资源文件lx的下载链接,传递给weex容器实现资源加载和页面渲染
flutter:配置相关的routeName,传递给FlutterViewController实现flutter端路由的切换
web:直接通过url,生成WebVC,实现页面跳转和H5资源加载