Commit 2c1b0f91 authored by 陈龙's avatar 陈龙

feat: 优化滚动组件

parent 7496bf0a
...@@ -97,8 +97,6 @@ const AlarmScrollAssembly = (props) => { ...@@ -97,8 +97,6 @@ const AlarmScrollAssembly = (props) => {
runTimer(secondRequest?.data?.list.length || 0); runTimer(secondRequest?.data?.list.length || 0);
}; };
const runTimer = (num) => { const runTimer = (num) => {
console.log('timer: ', num);
console.log(enableToGetData);
let _interval = props.interval || 0; let _interval = props.interval || 0;
if (num > 200) _interval = 0; if (num > 200) _interval = 0;
timer = setTimeout(() => { timer = setTimeout(() => {
...@@ -126,16 +124,16 @@ const AlarmScrollAssembly = (props) => { ...@@ -126,16 +124,16 @@ const AlarmScrollAssembly = (props) => {
> >
<Swiper <Swiper
slidesPerView={1} slidesPerView={1}
modules={[Pagination]} // modules={[Pagination]}
pagination={ // pagination={
props.showTotal // props.showTotal
? { // ? {
type: 'fraction', // type: 'fraction',
formatFractionCurrent: (num) => `第${num}条`, // formatFractionCurrent: (num) => `第${num}条`,
formatFractionTotal: (num) => `共${num}条`, // formatFractionTotal: (num) => `共${num}条`,
} // }
: false // : false
} // }
navigation={props.showTotal ? true : false} navigation={props.showTotal ? true : false}
autoplay={{ autoplay={{
delay: 3000, delay: 3000,
...@@ -144,7 +142,6 @@ const AlarmScrollAssembly = (props) => { ...@@ -144,7 +142,6 @@ const AlarmScrollAssembly = (props) => {
loop loop
direction="vertical" direction="vertical"
onSlideChange={(e) => { onSlideChange={(e) => {
console.log(enableToGetData);
if (e.activeIndex === realTimeDataList.length - 1 && enableToGetData) getData(); if (e.activeIndex === realTimeDataList.length - 1 && enableToGetData) getData();
}} }}
> >
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
&.moreThan1000 { &.moreThan1000 {
:global { :global {
.swiper-container { .swiper-container {
width: 950px; width: 100%;
min-width: 400px;
height: 42px; height: 42px;
.swiper-button-prev { .swiper-button-prev {
...@@ -46,7 +47,8 @@ ...@@ -46,7 +47,8 @@
&.lessThan1000 { &.lessThan1000 {
:global { :global {
.swiper-container { .swiper-container {
width: 950px; width: 100%;
min-width: 400px;
height: 42px; height: 42px;
.swiper-button-prev { .swiper-button-prev {
...@@ -83,8 +85,8 @@ ...@@ -83,8 +85,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
//width: 100%; width: 100%;
min-width: 930px; min-width: 400px;
height: 42px; height: 42px;
//overflow-y: scroll; //overflow-y: scroll;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment