Element-ui官网自定义回到顶部插件内容如下,但是复制到自己的代码里没有显示。
<template>
Scroll down to see the bottom-right button.
<el-backtop target=".page-component__scroll .el-scrollbar__wrap" :bottom="100">
<div
style="{
height: 100%;
width: 100%;
background-color: #f2f5f6;
box-shadow: 0 0 6px rgba(0,0,0, .12);
text-align: center;
line-height: 40px;
color: #1989fa;
}"
>
UP
</div>
</el-backtop>
</template>
问题一:
搜查了一些资料得知,backtop组件代码不能放在尾部,要放在最外层的div里的第一个。
问题二:
但是我移动代码的位置后,仍然没有显示,需要将自定义代码中target=".page-component__scroll .el-scrollbar__wrap"
这段去掉。
修改后代码:
<template>
<div>
<el-backtop :bottom="60">
<div
style="{
height: 100%;
width: 100%;
background-color: #f2f5f6;
box-shadow: 0 0 6px rgba(0,0,0, .12);
text-align: center;
line-height: 40px;
color: #1989fa;
}"
>
UP
</div>
</el-backtop>
<!--自己的一些前端代码-->
</div>
</template>