mirror of
https://github.com/yudaocode/yudao-ui-admin-vue3.git
synced 2026-05-09 18:44:31 +00:00
【解决todo】handle命名
This commit is contained in:
@@ -23,21 +23,21 @@
|
||||
class="btn"
|
||||
text
|
||||
:icon="Download"
|
||||
@click="handlerBtnClick('download', imageDetail)"
|
||||
@click="handleBtnClick('download', imageDetail)"
|
||||
/>
|
||||
<el-button
|
||||
class="btn"
|
||||
text
|
||||
:icon="RefreshRight"
|
||||
@click="handlerBtnClick('regeneration', imageDetail)"
|
||||
@click="handleBtnClick('regeneration', imageDetail)"
|
||||
/>
|
||||
<el-button
|
||||
class="btn"
|
||||
text
|
||||
:icon="Delete"
|
||||
@click="handlerBtnClick('delete', imageDetail)"
|
||||
@click="handleBtnClick('delete', imageDetail)"
|
||||
/>
|
||||
<el-button class="btn" text :icon="More" @click="handlerBtnClick('more', imageDetail)" />
|
||||
<el-button class="btn" text :icon="More" @click="handleBtnClick('more', imageDetail)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="image-wrapper" ref="cardImageRef">
|
||||
@@ -54,7 +54,7 @@
|
||||
v-for="button in imageDetail?.buttons"
|
||||
:key="button"
|
||||
style="min-width: 40px; margin-left: 0; margin-right: 10px; margin-top: 5px"
|
||||
@click="handlerMjBtnClick(button)"
|
||||
@click="handleMjBtnClick(button)"
|
||||
>
|
||||
{{ button.label }}{{ button.emoji }}
|
||||
</el-button>
|
||||
@@ -79,11 +79,11 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
/** 按钮 - 点击事件 */
|
||||
const handlerBtnClick = async (type, imageDetail: ImageVO) => {
|
||||
const handleBtnClick = async (type, imageDetail: ImageVO) => {
|
||||
emits('onBtnClick', type, imageDetail)
|
||||
}
|
||||
|
||||
const handlerLoading = async (status: number) => {
|
||||
const handleLoading = async (status: number) => {
|
||||
// TODO @fan:这个搞成 Loading 组件,然后通过数据驱动,这样搞可以哇?
|
||||
if (status === AiImageStatusEnum.IN_PROGRESS) {
|
||||
cardImageLoadingInstance.value = ElLoading.service({
|
||||
@@ -99,7 +99,7 @@ const handlerLoading = async (status: number) => {
|
||||
}
|
||||
|
||||
/** mj 按钮 click */
|
||||
const handlerMjBtnClick = async (button: ImageMjButtonsVO) => {
|
||||
const handleMjBtnClick = async (button: ImageMjButtonsVO) => {
|
||||
// 确认窗体
|
||||
await message.confirm(`确认操作 "${button.label} ${button.emoji}" ?`)
|
||||
emits('onMjBtnClick', button, props.imageDetail)
|
||||
@@ -108,7 +108,7 @@ const handlerMjBtnClick = async (button: ImageMjButtonsVO) => {
|
||||
// watch
|
||||
const { imageDetail } = toRefs(props)
|
||||
watch(imageDetail, async (newVal, oldVal) => {
|
||||
await handlerLoading(newVal.status as string)
|
||||
await handleLoading(newVal.status as string)
|
||||
})
|
||||
|
||||
// emits
|
||||
@@ -116,7 +116,7 @@ const emits = defineEmits(['onBtnClick', 'onMjBtnClick'])
|
||||
|
||||
//
|
||||
onMounted(async () => {
|
||||
await handlerLoading(props.imageDetail.status as string)
|
||||
await handleLoading(props.imageDetail.status as string)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user