mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] PullRefresh: optimize loading
This commit is contained in:
parent
0c641f7d63
commit
a6b429cf58
@ -150,11 +150,7 @@ export default sfc({
|
||||
|
||||
const Status = this.slots(status) || [
|
||||
TEXT_STATUS.indexOf(status) !== -1 && <div class={bem('text')}>{text}</div>,
|
||||
status === 'loading' && (
|
||||
<Loading class={bem('loading')} size="16">
|
||||
{text}
|
||||
</Loading>
|
||||
)
|
||||
status === 'loading' && <Loading size="16">{text}</Loading>
|
||||
];
|
||||
|
||||
return (
|
||||
|
@ -24,7 +24,7 @@ exports[`change head content when pulling down 3`] = `
|
||||
<div class="van-pull-refresh">
|
||||
<div class="van-pull-refresh__track" style="transition: 300ms; transform: translate3d(0,50px, 0);">
|
||||
<div class="van-pull-refresh__head">
|
||||
<div class="van-loading van-loading--circular van-pull-refresh__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(201, 201, 201); width: 16px; height: 16px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text">加载中...</span></div>
|
||||
<div class="van-loading van-loading--circular"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(201, 201, 201); width: 16px; height: 16px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text">加载中...</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -34,7 +34,7 @@ exports[`change head content when pulling down 4`] = `
|
||||
<div class="van-pull-refresh">
|
||||
<div class="van-pull-refresh__track" style="transition: 300ms; transform: translate3d(0,50px, 0);">
|
||||
<div class="van-pull-refresh__head">
|
||||
<div class="van-loading van-loading--circular van-pull-refresh__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(201, 201, 201); width: 16px; height: 16px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text">加载中...</span></div>
|
||||
<div class="van-loading van-loading--circular"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(201, 201, 201); width: 16px; height: 16px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text">加载中...</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -67,23 +67,23 @@ export default sfc({
|
||||
const { type, message } = this;
|
||||
const style = STYLE.indexOf(type) !== -1 ? 'default' : type;
|
||||
|
||||
const Content = () => {
|
||||
function Content() {
|
||||
switch (style) {
|
||||
case 'text':
|
||||
return <div>{message}</div>;
|
||||
case 'html':
|
||||
return <div domPropsInnerHTML={message} />;
|
||||
default:
|
||||
return [
|
||||
type === 'loading' ? (
|
||||
<Loading color="white" type={this.loadingType} />
|
||||
) : (
|
||||
<Icon class={bem('icon')} name={type} />
|
||||
),
|
||||
isDef(message) && <div class={bem('text')}>{message}</div>
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
return [
|
||||
type === 'loading' ? (
|
||||
<Loading color="white" type={this.loadingType} />
|
||||
) : (
|
||||
<Icon class={bem('icon')} name={type} />
|
||||
),
|
||||
isDef(message) && <div class={bem('text')}>{message}</div>
|
||||
];
|
||||
}
|
||||
|
||||
return (
|
||||
<transition name="van-fade">
|
||||
|
Loading…
x
Reference in New Issue
Block a user