weex官方指南里面有这么一句话:
如果在定制组件时使用了目前 Weex 不支持的标签或样式,还需要在 Android 和 iOS 中有相应的实现,否则会导致渲染异常。
实在没能搞明白是什么意思。
我在weex工程里面定义了一个组件
<template>
<div class="myClass">
<button>按钮</button>
<scroll></scroll>
</div>
</template>
<script>
export default {
name: 'MyComponent'
}
</script>
<style scoped>
.myClass {
background-color: blue;
width: 375px;
height: 300px;
}
</style>
在iOS里面自定义了一个组件
[WXSDKEngine registerComponent:@"MyComponent" withClass:NSClassFromString(@"MyComponent")];
然后在weex里面直接 <MyComponent></MyComponent> 运行之后打包index.js文件。ios下载解析到该文件时使用的组件却是weex工程里面自定义的组件MyComponent而不是ios工程里面自定义的组件。如果weex工程没有实现这个自定义组件的话,ios工程运行能够达到想要的效果显示ios自定义的组件,但是这样怎么保证三端统一呢?
ios端调用ios端的组件,weex端调用weex端的组件,这个要怎么做到呢?自定义模块也有一样的疑惑,
在iOS端自定义模块,weex直接使用是可以调起ios的方法,但是如果在weex里面注册了模块weex.registerModule那么在ios端跑起来的时候也是一直走的weex端的模块代码,实在是不理解。