老师帮我看看吧,我自己对了半天源码还是没找到控制台报错的位置,谢谢老师,
import './slider.css';
import './btn.css';
import Slider from './module';
import render from './slider.art';
import { getData, getDelayedData } from 'api/getData';
const layoutEl = document.getElementById('slider-layout');
getData(
'https://www.imooc.com/api/mall-PC/index/slider?icode=J5E0AF3DF0B7224D5'
).then(data => {
console.log(data);
//[{url: 'http://alimc.img.imo]
// layoutEl.innerHTML = render({
// items: data
// });
const slider = new Slider(document.querySelector('.slider'), {
initialIndex: 0,
animation: true,
// 切换速度,单位:ms
speed: 300,
// 自动切换,单位:ms
autoplay: 0
});
const leftbtn = document.getElementById('leftbtn');
const rightbtn = document.getElementById('rightbtn');
const bannerEl = document.getElementById('banner');
leftbtn.addEventListener('click', () => {
slider.prev();
}, false);
rightbtn.addEventListener('click', () => {
slider.next();
}, false);
// 鼠标移入幻灯片停止自动切换
bannerEl.addEventListener('mouseenter', () => {
slider.pause();
}, false);
// 鼠标移出幻灯片开始自动切换
bannerEl.addEventListener('mouseleave', () => {
slider.autoplay();
}, false);
});
loading
.loading {
width: 100%;
font-size: 14px;
text-align: center;
}
.loading-inline.loading-indocator,
.loading-inline.loading-text {
display: inline-block;
}
loading.art
<div class="loading {{inline ? 'loading-inline':''}}">
<div class="loading-indocator">
<img src="./loading.gif" alt="loading" />
</div>
<div class="loading-test">
loading......
</div>
</div>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星