正常情况下网页虽然不会显示滚动条了,但是不会回到顶部.
1.点击弹出对话框的标签是a标签,而且加了href,去掉href就可以了(代码如下可以自己试试)
<template>
<div class="big">
<el-dialog
title="提示"
:visible.sync="centerDialogVisible"
width="30%"
center
>
<span>需要注意的是内容是默认不居中的</span>
<span slot="footer" class="dialog-footer">
<el-button @click="centerDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
</span>
</el-dialog>
<button @click="centerDialogVisible = true" class="btn">点击打开 Dialog</button>
<a href="#" @click="centerDialogVisible = true" class="btn">点击打开 Dialog</a>
</div>
</template>
<script>
export default {
name: 'App',
data(){
return{
centerDialogVisible: false
}
},
methods:{
}
}
</script>
<style>
.big{
height: 9999px;
width: 600px;
background-color: pink;
}
.btn{
position: relative;
top: 5000px;
}
</style>