Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
91fc4669
authored
May 28, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【优化】优化 Image Card 加载中
parent
ad10328b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
src/views/ai/image/ImageTaskCard.vue
+32
-2
No files found.
src/views/ai/image/ImageTaskCard.vue
View file @
91fc4669
<
template
>
<el-card
body-class=
""
class=
"image-card"
v-loading=
"imageDetail.status === 'in_progress'"
>
<el-card
body-class=
""
class=
"image-card"
>
<div
class=
"image-operation"
>
<div>
<el-button
type=
""
text
bg
v-if=
"imageDetail.status === 'in_progress'"
>
生成中
</el-button>
...
...
@@ -13,7 +13,7 @@
<el-button
class=
"btn"
text
:icon=
"More"
@
click=
"handlerBtnClick('more', imageDetail)"
/>
</div>
</div>
<div
class=
"image-wrapper"
>
<div
class=
"image-wrapper"
ref=
"cardImageRef"
>
<img
class=
"image"
:src=
"imageDetail?.picUrl"
/>
</div>
</el-card>
...
...
@@ -22,6 +22,10 @@
import
{
Delete
,
Download
,
More
}
from
"@element-plus/icons-vue"
;
import
{
ImageDetailVO
}
from
"@/api/ai/image"
;
import
{
PropType
}
from
"vue"
;
import
{
ElLoading
}
from
"element-plus"
;
const
cardImageRef
=
ref
<
any
>
()
// 卡片 image ref
const
cardImageLoadingInstance
=
ref
<
any
>
()
// 卡片 image ref
const
props
=
defineProps
({
imageDetail
:
{
...
...
@@ -37,9 +41,30 @@ const handlerBtnClick = async (type, imageDetail: ImageDetailVO ) => {
emits
(
'onBtnClick'
,
type
,
imageDetail
)
}
// 监听 imageDetail
// const { imageDetail } = toRefs(props)
// watch(imageDetail, async (newVal, oldValue) => {
// console.log('首次 watch')
//
// })
// emits
const
emits
=
defineEmits
([
'onBtnClick'
])
//
onMounted
(
async
()
=>
{
if
(
props
.
imageDetail
.
status
===
'in_progress'
)
{
cardImageLoadingInstance
.
value
=
ElLoading
.
service
({
target
:
cardImageRef
.
value
,
text
:
'生成中...'
})
}
else
{
if
(
cardImageLoadingInstance
.
value
)
{
cardImageLoadingInstance
.
value
.
close
();
cardImageLoadingInstance
.
value
=
null
;
}
}
})
</
script
>
<
style
scoped
lang=
"scss"
>
...
...
@@ -47,6 +72,9 @@ const emits = defineEmits(['onBtnClick'])
.image-card
{
width
:
320px
;
border-radius
:
10px
;
position
:
relative
;
display
:
flex
;
flex-direction
:
column
;
.image-operation
{
display
:
flex
;
...
...
@@ -63,6 +91,8 @@ const emits = defineEmits(['onBtnClick'])
.image-wrapper
{
overflow
:
hidden
;
margin-top
:
20px
;
height
:
280px
;
flex
:
1
;
.image
{
width
:
100%
;
...
...
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