current position:Home>Element after the spring frame assembly is opened, the scroll bar returns to the top

Element after the spring frame assembly is opened, the scroll bar returns to the top

2022-04-29 13:44:43Mercury_

Preface

I don't know if you have ever encountered the bullet box component content scrolling to the bottom , Close the pop box , Next open , The contents of the pop-up box still remain in the last position , How can we solve this problem ? In fact, setting two properties can easily solve this problem .

Before optimization :

 Insert picture description here

After optimization :

 Insert picture description here
The optimization method is very simple , We just need to give el-dialog Add the following two attributes to the component .

Parameters explain type The default value is
:lock-scroll Whether in Dialog When it appears, it will body Roll lock booleantrue
:append-to-bodyDialog Whether to insert itself into body Element . Nested Dialog This attribute must be specified and assigned to truebooleanfalse
<el-dialog :lock-scroll="false" :append-to-body="true"></el-dialog>

copyright notice
author[Mercury_],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291204448503.html

Random recommended