Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

写的还挺专业啊. #6

Closed
aaawhz opened this issue Mar 13, 2018 · 4 comments
Closed

写的还挺专业啊. #6

aaawhz opened this issue Mar 13, 2018 · 4 comments

Comments

@aaawhz
Copy link

aaawhz commented Mar 13, 2018

No description provided.

@binggg binggg closed this as completed Mar 13, 2018
@aaawhz
Copy link
Author

aaawhz commented Mar 14, 2018

<div v-if="isInit" key="component"> <slot :loading="loading"></slot> </div> <div v-else-if="$slots.skeleton" key="skeleton"> <slot name="skeleton"></slot> </div> <div v-else key="loading"> </div>

@aaawhz
Copy link
Author

aaawhz commented Mar 14, 2018

能不能稍微解释下这段, 看明白了vue文档的slot, 还是看不懂这段.

@aaawhz
Copy link
Author

aaawhz commented Mar 14, 2018

列子里面没有传 loading ;
<vue-lazy-component> <st-movie-qq/> <st-movie-qq-skeleton slot="skeleton"/> </vue-lazy-component>

有类似这段, 这里因为有 slot='skeleton' 所以会进入 v-else-if='$slots.skeleton' 吧, 文档好像没有这种用法

@aaawhz
Copy link
Author

aaawhz commented Mar 14, 2018

isInit 是可以理解的, 进入可视区后, 会设置成true. 然后显示组件, 不进入其他分支, 隐藏骨架;

div v-else key='loading' class='loading' 这段可以自定义loading样式.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants