2024-08-26 19:09:43 +00:00
|
|
|
<!-- eslint-disable vue/multi-word-component-names -->
|
2023-09-12 22:05:48 +00:00
|
|
|
<template>
|
2024-08-26 19:09:43 +00:00
|
|
|
<slot v-if="state === 'show'" name="default" />
|
2023-09-12 22:05:48 +00:00
|
|
|
<span v-else>***</span>
|
2023-09-14 13:54:23 +00:00
|
|
|
<BulmaButton
|
2024-08-26 19:09:43 +00:00
|
|
|
:class="`is-small is-${button_class} ml-2`"
|
|
|
|
|
:icon="['fas', `${button_icon}`]"
|
|
|
|
|
:busy="state === 'click'"
|
2023-09-14 13:54:23 +00:00
|
|
|
@click="on_click"
|
|
|
|
|
/>
|
2023-09-12 22:05:48 +00:00
|
|
|
</template>
|
|
|
|
|
|
2024-08-26 19:09:43 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from "vue";
|
2024-08-27 00:25:42 +00:00
|
|
|
|
2023-09-14 13:54:23 +00:00
|
|
|
import BulmaButton from "./Button.vue";
|
|
|
|
|
|
2024-08-26 19:09:43 +00:00
|
|
|
const emit = defineEmits<{
|
|
|
|
|
load: [];
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const state = ref<"start" | "click" | "show">("start");
|
|
|
|
|
const button_class = ref<"primary" | "warning" | "danger">("primary");
|
|
|
|
|
const button_icon = ref<"eye-slash" | "eye">("eye-slash");
|
|
|
|
|
|
|
|
|
|
function on_click(): void {
|
|
|
|
|
switch (state.value) {
|
|
|
|
|
case "show":
|
|
|
|
|
state.value = "start";
|
|
|
|
|
button_class.value = "primary";
|
|
|
|
|
button_icon.value = "eye-slash";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "start":
|
|
|
|
|
state.value = "click";
|
|
|
|
|
button_class.value = "warning";
|
|
|
|
|
button_icon.value = "eye-slash";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "click":
|
|
|
|
|
state.value = "show";
|
|
|
|
|
button_class.value = "danger";
|
|
|
|
|
button_icon.value = "eye";
|
|
|
|
|
emit("load");
|
|
|
|
|
break;
|
2023-09-12 22:05:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|