babel-plugin-jsx
babel-plugin-jsx copied to clipboard
slot的文档希望再详细一点
情况一:没有完整例子 文档中只有定义slots对象,但是在组件里该这么用没说,只能试一遍。感觉如果文档写了,那大可不必
情况二:没有说明默认slot 正常来说默认插槽是很合理的,不过由于可能实现机制问题所以不支持,那希望也说一下,不然一直找,后来才发现么有
情况三:如果不写vSlots而直接使用默认插槽会有坑也没说明
const A = (props,ctx) => <>{ctx.slots.default?.()}</>
const B = () => <A>这是动态的内容</A>
上面代码实际上是能跑的,但是问题是里面的内容如果是动态或者发生了改变是不会触发更新的 这一点和情况二一样如果能提前说明一下会省事很多,当然如果能支持肯定更好,不然太别扭了,传个插槽得先传个对象
同感。
Hello @xmsz. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please be sure to fill in the default template in the Pull Request, provide changelog/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
const A = (props, ctx) => <>{ctx.slots.default?.()}</>;
const B = () => (
<A
v-slots={{
default: () => <>...</>,
}}
></A>
);
const A = (props, ctx) => ctx.slots.default?.();
const B = () => (
<A>{(<>...</>)}</A>
);
请问slots如何定义类型哦,比如定义slots只能使用字符串之类的