Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
best-code
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
等吃饭
best-code
Commits
97209913
Commit
97209913
authored
Nov 02, 2022
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文字轮播
parent
06e15acd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
31 deletions
+52
-31
README.md
README.md
+1
-1
index.jsx
src/pages/SwiperC/index.jsx
+46
-30
index.less
src/pages/SwiperC/index.less
+5
-0
No files found.
README.md
View file @
97209913
...
...
@@ -18,5 +18,5 @@
**金币收集动效:[Collect](http://gitlab2.dui88.com/wangqiang1/best-code/blob/master/src/pages/Collect/index.jsx)**
**普通轮播:[SwiperC](http://gitlab2.dui88.com/wangqiang1/best-code/blob/master/src/pages/SwiperC/index.jsx)**
**普通轮播
(奖品和文字轮播)
:[SwiperC](http://gitlab2.dui88.com/wangqiang1/best-code/blob/master/src/pages/SwiperC/index.jsx)**
src/pages/SwiperC/index.jsx
View file @
97209913
import
{
Marquee
}
from
"@spark/ui"
;
import
React
from
"react"
;
import
{
Swiper
,
SwiperSlide
}
from
'swiper/react'
;
...
...
@@ -13,38 +14,53 @@ const SwiperC = () => {
}
})
return
(
<
Swiper
className=
"prize-swiper"
// spaceBetween={10}
slidesPerView=
{
3
}
// slidesOffsetAfter={65}
autoplay=
{
{
delay
:
3000
,
disableOnInteraction
:
false
,
<
div
>
<
p
>
奖品轮播:
</
p
>
<
Swiper
className=
"prize-swiper"
// spaceBetween={10}
slidesPerView=
{
3
}
// slidesOffsetAfter={65}
autoplay=
{
{
delay
:
3000
,
disableOnInteraction
:
false
,
}
}
}
initialSlide=
{
0
}
// centerInsufficientSlides={prizeInfo.length <= 3}
centeredSlidesBounds=
{
true
}
observer
loop=
{
prizeInfo
.
length
>
3
}
>
{
prizeInfo
.
length
?
prizeInfo
.
map
((
item
,
index
)
=>
{
const
{
prizeName
,
prizeUrl
}
=
item
||
{}
return
(
<
SwiperSlide
key=
{
index
+
'swiper-1'
}
>
<
div
className=
"prize"
>
<
img
className=
"bg-box"
src=
{
prizeUrl
}
alt=
''
></
img
>
<
span
className=
"font"
>
{
prizeName
}
</
span
>
</
div
>
</
SwiperSlide
>
)
})
:
""
}
initialSlide=
{
0
}
// centerInsufficientSlides={prizeInfo.length <= 3}
centeredSlidesBounds=
{
true
}
observer
loop=
{
prizeInfo
.
length
>
3
}
>
{
prizeInfo
.
length
?
prizeInfo
.
map
((
item
,
index
)
=>
{
const
{
prizeName
,
prizeUrl
}
=
item
||
{}
return
(
<
SwiperSlide
key=
{
index
+
'swiper-1'
}
>
<
div
className=
"prize"
>
<
img
className=
"bg-box"
src=
{
prizeUrl
}
alt=
''
></
img
>
<
span
className=
"font"
>
{
prizeName
}
</
span
>
</
div
>
</
SwiperSlide
>
)
})
:
""
}
</
Swiper
>
<
p
>
文字轮播:
</
p
>
<
div
className=
"Marquee"
>
<
Marquee
baseData=
{
Array
(
10
).
fill
(
''
).
map
((
_
,
i
)
=>
'奖品轮播啊啊啊啊'
+
i
)
}
time=
{
2000
}
renderItem=
{
(
s
)
=>
{
return
<
div
>
{
s
}
</
div
>
}
}
/>
</
div
>
</
Swiper
>)
</
div
>
)
}
export
default
SwiperC
\ No newline at end of file
src/pages/SwiperC/index.less
View file @
97209913
.Marquee {
width: 300px;
height: 100px;
}
.prize-swiper {
margin-top: 72px;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment