diff --git a/resources/js/components/SMButton.vue b/resources/js/components/SMButton.vue
index aae03c5..ffbb796 100644
--- a/resources/js/components/SMButton.vue
+++ b/resources/js/components/SMButton.vue
@@ -21,6 +21,7 @@
'prevent-select',
classType,
{ 'button-block': block },
+ { 'dropdown-button': dropdown },
]"
:type="buttonType"
@click="handleClick">
@@ -29,12 +30,15 @@
-
+ @click.stop="handleToggleDropdown" />
+
-
+ @click.stop="handleClickItem(dropdownItem)">
{{ dropdownLabel }}
@@ -94,22 +98,24 @@ const props = defineProps({
},
});
-const showDropdown = ref(false);
const buttonType = props.type == "submit" ? "submit" : "button";
const classType = props.type == "submit" ? "primary" : props.type;
+const dropdownMenu = ref(null);
const emits = defineEmits(["click"]);
const handleClick = () => {
- showDropdown.value = false;
emits("click", "");
};
const handleToggleDropdown = () => {
- showDropdown.value = !showDropdown.value;
+ dropdownMenu.value.style.display = "block";
+};
+
+const handleMouseLeave = () => {
+ dropdownMenu.value.style.display = "none";
};
const handleClickItem = (item: string) => {
- showDropdown.value = false;
emits("click", item);
};
@@ -117,12 +123,18 @@ const handleClickItem = (item: string) => {