-
Notifications
You must be signed in to change notification settings - Fork 365
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/yesmeck/remax/377cptjah |
9d008d2
to
c9a3331
Compare
Codecov Report
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
+ Coverage 92.42% 93.29% +0.86%
==========================================
Files 183 225 +42
Lines 2641 2817 +176
Branches 328 335 +7
==========================================
+ Hits 2441 2628 +187
+ Misses 199 188 -11
Partials 1 1
Continue to review full report at Codecov.
|
c9a3331
to
25352fd
Compare
25352fd
to
07a29ff
Compare
API 改成: import { createNativeComponent } from 'remax';
const Video = createNativeComponent('video');
通过这种方式创建的组件不支持设置动态属性 |
这样还是同一个问题,cli不知道这个组件是用户创建的。 |
这样吧,定义一个基础组件: // Video.js
import { createNativeComponent } from 'remax';
export const nativeComponent = true;
export const props = ['src', 'autoPlay'];
const Video = createNativeComponent('video');
export default Video; 使用: import Video from './Video.js';
export default () => <Video src="xx" /> 然后 cli 在构建的时候,跟处理自定义组件的方式类似,在构建时也去 require |
export const type = 'component' 识别为原生组件。 这样以后也可以扩展,定义原生 API 等等。 这样如何 |
API 没这个需求吧,组件这么搞主要是为了照顾构建时 |
用这种后缀 ts 会有问题。 |
API不这么弄也可以。主要是 |
|
不需要 babel 解析,直接去 require 就可以的。 |
怎么判断 |
不然还是解析 createNativeComponent 表达式。 createNativeComponent('custom-component', ['foo', 'bar']); 要求参数都必须直接声明,不能用变量。 |
113be4c
to
72d5c1c
Compare
72d5c1c
to
01eacb7
Compare
由于type定义很多本身必填的 option 其实也是不需要的,所以不如去掉 optionalPromisify,给 promisify 的 option 加个默认值
16b7af0
to
0e5bf7d
Compare
这个 codesandbox ci 不发包应该是过不了了 |
remax.macro 先单独发一个吧 |
发个 0.0.1,不然没法测试 |
这个已经发了,是 remax 还没发 |
那 codesandbox 应该能构建出来啊 |
那你进去看看为什么 codesandbox 不行 |
1b56cf3
to
6a7c57d
Compare
搞定了 😈 |
b5a5e1c
to
f1a1e33
Compare
packages/remax/macro.js
Outdated
@@ -0,0 +1,14 @@ | |||
function exportWrapper(module) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件没在 npm 包里
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codesandbox 吗?我下下来有啊
03c51ad
to
14dbc57
Compare
引入 remax.macro 注册 host 组件 resolve #293
14dbc57
to
edae15e
Compare
No description provided.