参考:
1,https://blog.csdn.net/weixin_42598901/article/details/99674145
2,https://www.cnblogs.com/rogerwu/p/9543563.html
3,https://blog.csdn.net/qq_36070288/article/details/84765139
4,https://www.cnblogs.com/chendada/p/11238746.html
5,https://blog.csdn.net/qq348843576/article/details/103261602
三行代码就足够。如果报错,就在headContainer类的样式中加上这个2个属性:height: 100vh;overflow-x: hidden;
target要指向触发滚动的对象
<el-backtop target=".headContainer">
<i class="el-icon-caret-top"></i>
</el-backtop>
效果图: