feat. 버튼 액션별 아이콘 추가
This commit is contained in:
@@ -11,7 +11,6 @@ interface ButtonListProps {
|
||||
|
||||
const props = defineProps<ButtonListProps>()
|
||||
|
||||
// 상수 정의
|
||||
const BUTTON_TYPE_MAP = {
|
||||
URL: {
|
||||
_self: 'internal' as const,
|
||||
@@ -35,23 +34,6 @@ const getButtonType = (btnInfo: PageDataResourceGroupBtnInfo): ButtonType => {
|
||||
|
||||
return DEFAULT_BUTTON_TYPE
|
||||
}
|
||||
|
||||
const getButtonProps = (button: PageDataResourceGroup) => ({
|
||||
type: getButtonType(button.btn_info),
|
||||
target: button.btn_info?.detail?.action?.link_target,
|
||||
href: button.btn_info?.detail?.action?.url,
|
||||
rel: button.btn_info?.detail?.action?.rel,
|
||||
backgroundColor: getColorCode({
|
||||
colorName: button.btn_info?.color_name_btn,
|
||||
colorCode: button.btn_info?.color_code_btn,
|
||||
}),
|
||||
textColor: getColorCode({
|
||||
colorName: button.btn_info?.color_name_txt,
|
||||
colorCode: button.btn_info?.color_code_txt,
|
||||
}),
|
||||
disabled: button.btn_info?.disabled,
|
||||
text: button.btn_info?.txt_btn_name,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -62,7 +44,23 @@ const getButtonProps = (button: PageDataResourceGroup) => ({
|
||||
<AtomsButton
|
||||
v-for="(button, index) in props.resourcesData"
|
||||
:key="index"
|
||||
v-bind="getButtonProps(button)"
|
||||
:type="getButtonType(button.btn_info)"
|
||||
:target="button.btn_info?.detail?.action?.link_target"
|
||||
:href="button.btn_info?.detail?.action?.url"
|
||||
:rel="button.btn_info?.detail?.action?.rel"
|
||||
:background-color="
|
||||
getColorCode({
|
||||
colorName: button.btn_info?.color_name_btn,
|
||||
colorCode: button.btn_info?.color_code_btn,
|
||||
})
|
||||
"
|
||||
:text-color="
|
||||
getColorCode({
|
||||
colorName: button.btn_info?.color_name_txt,
|
||||
colorCode: button.btn_info?.color_code_txt,
|
||||
})
|
||||
"
|
||||
:disabled="button.btn_info?.disabled"
|
||||
class="size-extra-small md:size-medium"
|
||||
>
|
||||
{{ button.btn_info?.txt_btn_name }}
|
||||
|
||||
Reference in New Issue
Block a user