在Weex中定制自定义组件
1.配置自定义组件
public class MyViewComponent extends WXComponent{ public MyViewComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent, String instanceId, boolean lazy) { super(instance, node, parent, instanceId, lazy); } @Override protected void initView() { //TODO:your own code …… } @Override public WXFrameLayout getView() { //TODO:your own code ……… } @WXComponentProp(name=WXDomPropConstant.WX_ATTR_VALUE) public void setMyViewValue(String value) { ((TextView)mHost).setText(value); } }
2.注册组件
WXSDKEngine.registerComponent("MyView", MyViewComponent.class);