forked from faker-js/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
method.vue
49 lines (40 loc) · 1.34 KB
/
method.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<script setup lang="ts">
import type { Method } from './method';
import MethodParameters from './method-parameters.vue';
const props = defineProps<{ method: Method }>();
function seeAlsoToUrl(see: string): string {
const [, module, method] = see.replace(/\(.*/, '').split('\.');
return module + '.html#' + method;
}
</script>
<template>
<div>
<div v-if="props.method.deprecated" class="warning custom-block">
<p class="custom-block-title">Deprecated</p>
<p>This method is deprecated and will be removed in a future version.</p>
</div>
<div v-html="props.method.description"></div>
<div v-if="props.method.since">
<p>
<em>Available since v<span v-html="props.method.since" /></em>
</p>
</div>
<MethodParameters
v-if="props.method.parameters.length > 0"
:parameters="props.method.parameters"
/>
<p><strong>Returns:</strong> {{ props.method.returns }}</p>
<div v-html="props.method.examples" />
<div v-if="props.method.seeAlsos.length > 0">
<h3>See Also</h3>
<ul>
<li v-for="seeAlso of props.method.seeAlsos" :key="seeAlso">
<a v-if="seeAlso.startsWith('faker.')" :href="seeAlsoToUrl(seeAlso)">
{{ seeAlso }}
</a>
<template v-else>{{ seeAlso }}</template>
</li>
</ul>
</div>
</div>
</template>