mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
perf(ImagePreview): improve render perf
This commit is contained in:
parent
0753ab03d0
commit
b844a038fa
@ -98,9 +98,12 @@ export default createComponent({
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value(val) {
|
value(val) {
|
||||||
this.setActive(this.startPosition);
|
if (val) {
|
||||||
|
this.setActive(this.startPosition);
|
||||||
if (!val) {
|
this.$nextTick(() => {
|
||||||
|
this.$refs.swipe.swipeTo(this.startPosition, { immediate: true });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.$emit('close', {
|
this.$emit('close', {
|
||||||
index: this.active,
|
index: this.active,
|
||||||
url: this.images[this.active]
|
url: this.images[this.active]
|
||||||
@ -310,13 +313,13 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!this.value) {
|
if (!this.shouldRender) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<transition name="van-fade">
|
<transition name="van-fade">
|
||||||
<div class={[bem(), this.className]}>
|
<div vShow={this.value} class={[bem(), this.className]}>
|
||||||
{this.genImages()}
|
{this.genImages()}
|
||||||
{this.genIndex()}
|
{this.genIndex()}
|
||||||
{this.genCover()}
|
{this.genCover()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user