JSPatch下发笔记1

简介: JSPatch下发笔记1

原代码

@implementation CommunityViewController
- (void)jump:(UIButton *)sender{
    CommunityBannerModel *model = _arr[sender.tag];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setValue:model.action_type forKey:@"type"];
    [dict setValue:model.url forKey:@"value"];
    [[PushJumpManager sharedInstance]pushActionWithModel:dict];
}
@end


JS代码

require('NSMutableDictionary,PushJumpManager');
defineClass('CommunityViewController', {
            jump: function(sender) {
            var i = sender.tag();
            var model = self.valueForKey("_arr").objectAtIndex(i);
            console.log(model);
            var dict = NSMutableDictionary.dictionary();
            console.log(dict);
            dict.setValue_forKey(model.valueForKey("action_type"), "type");
            console.log(model.valueForKey("action_type"));
            dict.setValue_forKey(model.valueForKey("url"), "value");
            console.log(model.valueForKey("action_type"));
            console.log(dict);
            PushJumpManager.sharedInstance().pushActionWithModel(dict);
            },
            });


注意:


1.把需要用到的类写在require方法里,相当于引用。

2.实例变量的写法。

_arr   写成  self.valueForKey("_arr")

3.数组下标的写法。

arr[i]写成arr.objectAtIndex(i)

4.jsonModel值的写法。

model.url写成model.valueForKey("url")

5.在调试的时候把需要打印的值用console.log()方法输出到控制台方便调试。

目录
相关文章
|
JavaScript
JSPatch下发笔记2
JSPatch下发笔记2
151 0
|
JavaScript
JSPatch下发笔记8
JSPatch下发笔记8
136 0
|
JavaScript
JSPatch下发笔记3
JSPatch下发笔记3
132 0
JSPatch下发笔记6
JSPatch下发笔记6
111 0
|
JavaScript
JSPatch下发笔记9
JSPatch下发笔记9
116 0
|
JavaScript
JSPatch下发笔记10
JSPatch下发笔记10
123 0
|
JavaScript
JSPatch下发笔记7
JSPatch下发笔记7
143 0
|
JavaScript
JSPatch下发笔记4
JSPatch下发笔记4
136 0
JSPatch下发笔记5
JSPatch下发笔记5
126 0
|
9月前
|
安全
JSPatch被停用了,也就是不能使用JSPatch第三方框架热修复了
JSPatch被停用了,也就是不能使用JSPatch第三方框架热修复了
145 0

热门文章

最新文章