Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
vue-kwan-admin
提交
fa2ae1a8
V
vue-kwan-admin
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
vue-kwan-admin
通知
38
Star
6
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-kwan-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
fa2ae1a8
编写于
8月 09, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:新增图片翻页
上级
51c6f83d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
50 addition
and
3 deletion
+50
-3
src/components/menus/MyPic.vue
src/components/menus/MyPic.vue
+50
-3
未找到文件。
src/components/menus/MyPic.vue
浏览文件 @
fa2ae1a8
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<el-table-column
prop=
"picName"
label=
"图片名字"
width=
"240"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"picName"
label=
"图片名字"
width=
"240"
show-overflow-tooltip
></el-table-column>
<el-table-column
align=
"center"
>
<el-table-column
align=
"center"
>
<template
slot-scope=
"props"
>
<template
slot-scope=
"props"
>
<img
:src=
"props.row.picUrl"
alt=
"图片"
height=
"100px"
@
click=
"showImageDialog(props.row.picUrl)"
style=
"cursor: pointer"
/>
<img
:src=
"props.row.picUrl"
alt=
"图片"
height=
"100px"
@
click=
"showImageDialog(props.row.picUrl
, props.$index
)"
style=
"cursor: pointer"
/>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"创建时间"
width=
"170"
>
<el-table-column
label=
"创建时间"
width=
"170"
>
...
@@ -20,8 +20,17 @@
...
@@ -20,8 +20,17 @@
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<el-dialog
:visible.sync=
"imageDialogVisible"
width=
"30%"
>
<el-dialog
:visible.sync=
"imageDialogVisible"
width=
"30%"
>
<img
:src=
"enlargedImageUrl"
alt=
"放大图片"
style=
"width: 100%"
/>
<div
style=
"display: flex; align-items: center; justify-content: space-between"
>
<button
class=
"arrow-button"
:class=
"{ disabled: imageIndex === 0 }"
@
click=
"showBeforeImage"
:disabled=
"imageIndex === 0"
>
<el-icon
class=
"custom-icon"
name=
"arrow-left"
></el-icon>
</button>
<img
:src=
"enlargedImageUrl"
alt=
"放大图片"
style=
"width: 80%"
/>
<button
class=
"arrow-button"
:class=
"{ disabled: imageIndex === picList.length - 1 }"
@
click=
"showNextImage"
:disabled=
"imageIndex === picList.length - 1"
>
<el-icon
class=
"custom-icon"
name=
"arrow-right"
></el-icon>
</button>
</div>
</el-dialog>
</el-dialog>
<el-pagination
class=
"pagination"
background
:key=
"elementui_page_component_key"
:current-page.sync=
"currentPage"
:page-size=
"pageSize"
:total=
"total"
@
current-change=
"handleCurrentChange"
></el-pagination>
<el-pagination
class=
"pagination"
background
:key=
"elementui_page_component_key"
:current-page.sync=
"currentPage"
:page-size=
"pageSize"
:total=
"total"
@
current-change=
"handleCurrentChange"
></el-pagination>
</el-main>
</el-main>
</el-container>
</el-container>
...
@@ -43,6 +52,7 @@ export default {
...
@@ -43,6 +52,7 @@ export default {
total
:
0
,
total
:
0
,
imageDialogVisible
:
false
,
imageDialogVisible
:
false
,
enlargedImageUrl
:
''
,
enlargedImageUrl
:
''
,
imageIndex
:
0
,
// 当前展示的图片索引
options
:
[
options
:
[
{
{
value
:
0
,
value
:
0
,
...
@@ -73,9 +83,26 @@ export default {
...
@@ -73,9 +83,26 @@ export default {
this
.
queryPic
()
this
.
queryPic
()
},
},
methods
:
{
methods
:
{
showImageDialog
(
url
)
{
showBeforeImage
()
{
if
(
this
.
imageIndex
>
0
)
{
// 增加索引以显示下一张图片
this
.
imageIndex
--
this
.
enlargedImageUrl
=
this
.
picList
[
this
.
imageIndex
].
picUrl
this
.
imageDialogVisible
=
true
// 打开对话框展示图片
}
},
showNextImage
()
{
if
(
this
.
imageIndex
<
this
.
picList
.
length
-
1
)
{
// 增加索引以显示下一张图片
this
.
imageIndex
++
this
.
enlargedImageUrl
=
this
.
picList
[
this
.
imageIndex
].
picUrl
this
.
imageDialogVisible
=
true
}
},
showImageDialog
(
url
,
index
)
{
this
.
enlargedImageUrl
=
url
this
.
enlargedImageUrl
=
url
this
.
imageDialogVisible
=
true
this
.
imageDialogVisible
=
true
this
.
imageIndex
=
index
},
},
async
queryPic
()
{
async
queryPic
()
{
this
.
loading
=
true
this
.
loading
=
true
...
@@ -115,4 +142,24 @@ export default {
...
@@ -115,4 +142,24 @@ export default {
margin-top: 16px;
margin-top: 16px;
text-align: right;
text-align: right;
}
}
.arrow-button {
display: flex;
align-items: center;
justify-content: center;
border: none;
background-color: transparent;
cursor: pointer;
}
.custom-icon {
font-size: 24px; /* 调整图标大小 */
color: #ff9900; /* 调整图标颜色 */
margin-right: 6px; /* 调整图标与文字之间的间距 */
}
.arrow-button.disabled {
pointer-events: none; /* 禁用点击事件 */
opacity: 0.1; /* 添加透明度来表示禁用状态 */
}
</
style
>
</
style
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录