Skip to content

纯求知: Custome Element里slot的内容会在shadowRoot下以及shadowRoot旁边各出现一份? #273

Closed Answered by sanqi-med
yoyo837 asked this question in Q&A
Discussion options

You must be logged in to vote

quarkc 目前的玩法是类似原生标签,组件的通信主要是通过事件,如果想在父组件里面拿子组件的数据,通过事件即可(或者是父组件里面拿子组件的实例,然后调用实例方法拿数据,不推荐)。如果想在子组件拿父组件的数据通过props传递即可。如果是应用层面的公共数据想在自定义组件里面获取,可以使用 store 类似的机制,存内层里的store,或者浏览器的store都可以达到你的目的。

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@yoyo837
Comment options

@xsf0105
Comment options

@yoyo837
Comment options

@sanqi-med
Comment options

Answer selected by yoyo837
@yoyo837
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants