Files
certd/packages/ui/certd-client/src/components/tutorial/index.vue
T

55 lines
1.2 KiB
Vue
Raw Normal View History

2024-09-29 00:38:17 +08:00
<script setup lang="ts">
2026-01-26 18:49:16 +08:00
import { onMounted, ref } from "vue";
2024-09-29 00:38:17 +08:00
import TutorialSteps from "/@/components/tutorial/tutorial-steps.vue";
2026-01-26 18:49:16 +08:00
import { mitter } from "/@/utils/util.mitt";
import { useI18n } from "/@/locales";
2025-03-10 16:06:40 +08:00
2025-06-29 14:09:09 +08:00
defineOptions({
name: "TutorialModal",
});
2025-03-10 16:06:40 +08:00
const props = defineProps<{
showIcon?: boolean;
2026-01-26 18:49:16 +08:00
mode?: string;
2025-03-10 16:06:40 +08:00
}>();
2024-09-29 00:38:17 +08:00
const openedRef = ref(false);
function open() {
openedRef.value = true;
}
2024-10-31 10:32:05 +08:00
const slots = defineSlots();
2026-01-26 18:49:16 +08:00
onMounted(() => {
mitter.on("openTutorialModal", () => {
if (props.mode === "nav") {
open();
}
});
});
const { t } = useI18n();
2024-09-29 00:38:17 +08:00
</script>
<template>
2024-10-31 10:32:05 +08:00
<div class="tutorial-button pointer" @click="open">
<template v-if="!slots.default">
2025-06-29 14:09:09 +08:00
<fs-icon v-if="showIcon === false" icon="ant-design:question-circle-outlined" class="mr-0.5"></fs-icon>
2026-01-26 18:49:16 +08:00
<div class="hidden md:block">{{ t("tutorial.title") }}</div>
2024-10-31 10:32:05 +08:00
</template>
<slot></slot>
2024-09-29 00:38:17 +08:00
<a-modal v-model:open="openedRef" class="tutorial-modal" width="90%">
2026-01-26 18:49:16 +08:00
<template #title>{{ t("tutorial.title") }}</template>
2024-09-29 00:38:17 +08:00
<tutorial-steps v-if="openedRef" />
<template #footer></template>
</a-modal>
</div>
</template>
<style lang="less">
.tutorial-modal {
2024-09-29 14:57:20 +08:00
top: 50px;
2024-09-29 00:38:17 +08:00
.ant-modal-body {
2024-09-29 14:57:20 +08:00
height: 80vh;
2024-09-29 00:38:17 +08:00
}
}
</style>