perf(Calendar): simplify placeholder dom (#8955)

This commit is contained in:
neverland 2021-06-30 10:02:50 +08:00 committed by GitHub
parent be3a7d7497
commit 9040bfd77c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 81 deletions

View File

@ -136,6 +136,11 @@ export default defineComponent({
return () => {
const { type, className } = props.item;
if (type === 'placeholder') {
return <div class={bem('day')} style={style.value} />;
}
return (
<div
role="gridcell"

View File

@ -190,34 +190,24 @@ exports[`should render demo and match snapshot 1`] = `
<div role="grid"
class="van-calendar__days"
>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
</div>
@ -229,34 +219,24 @@ exports[`should render demo and match snapshot 1`] = `
<div role="grid"
class="van-calendar__days"
>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
</div>
@ -268,34 +248,24 @@ exports[`should render demo and match snapshot 1`] = `
<div role="grid"
class="van-calendar__days"
>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
</div>

View File

@ -37,40 +37,28 @@ exports[`color prop when type is range 1`] = `
<div role="grid"
class="van-calendar__days"
>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
</div>
@ -606,40 +594,28 @@ exports[`popup wrapper 2`] = `
<div role="grid"
class="van-calendar__days"
>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
<div role="gridcell"
<div class="van-calendar__day"
style="width: 100%;"
class="van-calendar__day van-calendar__day--placeholder"
tabindex="-1"
>
</div>
</div>