fix. [SWV-866] 액션버튼 기능 개선
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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: 사용함
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user