fix. [SWV-866] 액션버튼 기능 개선

This commit is contained in:
clkim
2026-03-10 15:41:20 +09:00
parent e594231686
commit 532b9b6855
4 changed files with 19 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { ImageButtonType } from '#layers/types/components/button'
import type { ButtonType } from '#layers/types/components/button'
interface props {
type?: ImageButtonType
type?: ButtonType
href?: string
backgroundImage: string
alt: string
@@ -18,13 +18,14 @@ const componentTag = computed((): string => {
switch (props.type) {
case 'external':
return 'a'
case 'download':
return props.href ? 'a' : 'button'
case 'internal':
return 'AtomsLocaleLink'
default:
return 'button'
}
})
const componentProps = computed(() => {
if (props.type === 'external') {
return {
@@ -43,6 +44,17 @@ const componentProps = computed(() => {
return {}
}
if (props.type === 'download') {
if (props.href) {
return {
href: props.href,
target: '_self',
download: props.href?.split('/').pop() ?? 'download',
}
}
return {}
}
return {}
})
const buttonStyle = computed(() => {

View File

@@ -156,8 +156,8 @@ const handleButtonClick = (button: PageDataResourceGroup) => {
const btnDetail = button.btn_info?.detail
const btnType = btnDetail?.btn_type
const handler = buttonClickHandlers[btnType]
handler?.(btnDetail)
}
</script>
@@ -201,8 +201,9 @@ const handleButtonClick = (button: PageDataResourceGroup) => {
<!-- 버튼 유형: 이미지 버튼 + 타입: 기타 -->
<AtomsButtonImage
v-else-if="!isLauncherButton(button)"
:type="getButtonType(button.btn_info)"
:href="button.btn_info?.detail?.action?.url"
:background-image="formatPathHost(button.btn_info?.res_path)"
:background-image="formatPathHost(button.btn_info?.res_path?.path)"
:alt="button.btn_info?.txt_btn_name"
:disabled="isDisabled(button)"
@click="handleButtonClick(button)"

View File

@@ -89,7 +89,7 @@ export interface PageDataResourceGroupBtnInfo extends ColorObject {
btn_category: string
txt_btn_name: string
detail: Record<string, any>
res_path?: string
res_path?: { path: string }
disabled?: boolean
use_game_font: 0 | 1 // 0: 사용하지 않음, 1: 사용함
}

View File

@@ -1,7 +1,5 @@
export type ButtonType = 'internal' | 'external' | 'download' | 'action'
export type ImageButtonType = 'internal' | 'external' | 'action'
export type LauncherButtonType = 'default' | 'duplication' | 'single'
export type ButtonSize = 'large' | 'medium' | 'small' | 'extra-small'