提交 34b5a7c7 编写于 作者: D DCloud_LXH

fix: case banner error

上级 82e7b340
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
</div> </div>
</template> </template>
<script> <script>
var sliderTime;
export default { export default {
data() { data() {
return { return {
...@@ -29,6 +31,9 @@ ...@@ -29,6 +31,9 @@
mounted() { mounted() {
this.StartBanner(); this.StartBanner();
}, },
beforeDestroy() {
clearInterval(sliderTime);
},
methods: { methods: {
StartBanner() { StartBanner() {
var banner = document.querySelector('.banner'), var banner = document.querySelector('.banner'),
...@@ -73,14 +78,14 @@ ...@@ -73,14 +78,14 @@
} }
setSlider(); setSlider();
window.onresize = setSlider; window.onresize = setSlider;
var sliderTime = setInterval(sliderStart, 5000); sliderTime = setInterval(sliderStart, 5000);
function sliderStart() { function sliderStart() {
//开始轮播) //开始轮播)
/* if(!~location.pathname.indexOf($docsify.banner)){ /* if(!~location.pathname.indexOf($docsify.banner)){
clearInterval(sliderTime); clearInterval(sliderTime);
return; return;
} */ } */
index += 1; index += 1;
if (index < 0 || index > sliderLength + 1) { if (index < 0 || index > sliderLength + 1) {
index = index < 0 ? 0 : sliderLength + 1; index = index < 0 ? 0 : sliderLength + 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册