2022-11-01 18:09:19 +08:00
|
|
|
<script setup lang="ts">
|
2023-03-10 14:43:22 +08:00
|
|
|
import { computed } from 'vue'
|
2022-11-01 18:09:19 +08:00
|
|
|
import { Warning } from '@element-plus/icons-vue'
|
2023-03-10 14:43:22 +08:00
|
|
|
import { useLang } from '../../composables/lang'
|
|
|
|
import apiTypingLocale from '../../../i18n/component/api-typing.json'
|
2022-11-01 18:09:19 +08:00
|
|
|
|
|
|
|
defineProps({
|
|
|
|
type: String,
|
|
|
|
details: String,
|
|
|
|
})
|
2023-03-10 14:43:22 +08:00
|
|
|
|
|
|
|
const lang = useLang()
|
|
|
|
const detail = computed(() => apiTypingLocale[lang.value].detail)
|
2022-11-01 18:09:19 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-11-07 23:01:32 +08:00
|
|
|
<span class="inline-flex items-center">
|
2022-11-01 21:52:16 +08:00
|
|
|
<code class="api-typing mr-1">
|
2022-11-01 18:09:19 +08:00
|
|
|
{{ type }}
|
2022-11-01 20:31:39 +08:00
|
|
|
</code>
|
2022-11-06 14:46:35 +08:00
|
|
|
<ClientOnly>
|
|
|
|
<ElTooltip v-if="details" effect="light" trigger="click">
|
2023-03-10 14:43:22 +08:00
|
|
|
<ElButton
|
|
|
|
text
|
|
|
|
:icon="Warning"
|
|
|
|
:aria-label="detail"
|
|
|
|
class="p-2 text-4"
|
|
|
|
/>
|
2022-11-06 14:46:35 +08:00
|
|
|
<template #content>
|
|
|
|
<slot>
|
2023-07-04 16:47:33 +08:00
|
|
|
<div class="m-1" style="max-width: 600px">
|
2022-11-06 14:46:35 +08:00
|
|
|
<code
|
|
|
|
style="
|
|
|
|
color: var(--code-tooltip-color);
|
|
|
|
background-color: var(--code-tooltip-bg-color);
|
|
|
|
"
|
|
|
|
>
|
|
|
|
{{ details }}
|
|
|
|
</code>
|
|
|
|
</div>
|
|
|
|
</slot>
|
|
|
|
</template>
|
|
|
|
</ElTooltip>
|
|
|
|
</ClientOnly>
|
2022-11-01 18:09:19 +08:00
|
|
|
</span>
|
|
|
|
</template>
|