weex 调用componet 《template> 《div class="wrapper"> 《test class="test">《/test> 《/div> 《/template> 1.扩展步骤 创建类继承WXComponent #import "WXComponent.h" #import <UIKit/UIKit.h> @interface LQComponent : WXComponent
@end 2.实现方法
-
(instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance{
self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]; if (self) {
} return self; }
-
(void)viewDidLoad{ //添加视图 [super viewDidLoad]; _testView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)]; _testView.backgroundColor = [UIColor redColor]; [self.view addSubview:_testView]; }
/* 加载视图 */
- (UIView *)loadView{ NSLog(@"2"); return _testView; }