Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ai_web_page_prod
Overview
Overview
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
ai_web_page_prod
Commits
0a454796
Commit
0a454796
authored
Apr 16, 2023
by
haojie[
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
03511240
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
src/components/custom/swiper/test.vue
+3
-4
No files found.
src/components/custom/swiper/test.vue
View file @
0a454796
...
...
@@ -30,7 +30,6 @@ import { ref, onMounted } from "vue";
export
default
{
setup
()
{
// 初始卡片数量和选中的卡片索引
const
cardNum
=
10
;
const
slideIndex
=
ref
(
0
);
// 用 ref 保存当前显示的卡片数组和克隆数组
const
cards
=
ref
([
...
...
@@ -52,6 +51,7 @@ export default {
]);
const
cloneCards
=
ref
([]);
const
displayNum
=
ref
(
4
);
const
all_displayNum
=
ref
(
displayNum
.
value
+
1
);
const
displayCards
=
ref
([]);
// 用 ref 保存是否处于动画状态、是否停止轮播
...
...
@@ -59,16 +59,15 @@ export default {
const
stopPlaying
=
ref
(
false
);
onMounted
(()
=>
{
console
.
log
(
"我执行了"
);
// 克隆第一个和最后一个卡片,用于无限滚动
cloneCards
.
value
=
cards
.
value
.
concat
(
cards
.
value
.
slice
(
0
,
displayNum
.
value
)
cards
.
value
.
slice
(
0
,
all_
displayNum
.
value
)
);
// 显示指定数量的卡片
displayCards
.
value
=
cloneCards
.
value
.
slice
(
slideIndex
.
value
,
slideIndex
.
value
+
displayNum
.
value
slideIndex
.
value
+
all_
displayNum
.
value
);
// 自动播放
let
autoPlay
=
setInterval
(()
=>
{
...
...
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