Apidoc slot style changes

pull/3711/head
Bahadır Sofuoğlu 2023-03-07 00:50:56 +03:00
parent d02c5bd671
commit 2641659296
2 changed files with 18 additions and 23 deletions

View File

@ -324,11 +324,11 @@ if (project) {
const childSinature = child.signatures[0];
const parameters = childSinature.parameters.reduce((acc, { name, type }, index) => (index === 0 ? `${name}: ${type.name}` : `${acc}, ${name}: ${type.name}`), '');
type += ` \t ${childSinature.name}(${parameters}): ${childSinature.type?.name}, // ${childSinature.comment?.summary[0]?.text}\n `;
type += ` \t <b>${childSinature.name}(${parameters})</b>: ${childSinature.type?.name}, // ${childSinature.comment?.summary[0]?.text}\n `;
} else {
const childType = child.type.elementType ? child.type.elementType.name : child.type.name;
type += ` \t ${child.name}: ${childType}, // ${child.comment?.summary[0]?.text}\n `;
type += ` \t <b>${child.name}</b>: ${childType}, // ${child.comment?.summary[0]?.text}\n `;
}
});
}

View File

@ -29,18 +29,16 @@
</span>
<template v-else-if="k === 'type'">
<template v-for="(value, i) in getType(v)" :key="value">
{{ i !== 0 ? ' |' : '' }}
<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink>
<span v-else> {{ value }} </span>
{{ i !== 0 ? ' |' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link">{{ value }}</NuxtLink
><span v-else>{{ value }}</span>
</template>
</template>
<template v-else-if="k === 'parameters'">
<span v-if="v.name"> {{ v.name }} : </span>
<span v-if="v.name" :class="{ 'parameter-bold': label === 'Slots' }"> {{ v.name }} : </span>
<template v-for="(value, i) in getType(v.type)" :key="value">
{{ i !== 0 ? ' |' : '' }}
<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink>
<span v-else> {{ value }} </span>
{{ i !== 0 ? ' |' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink>
<span v-else v-html="value"> </span>
</template>
</template>
@ -86,22 +84,13 @@ export default {
},
methods: {
getType(value) {
const newValue = value?.split('|').map((item) => {
if (this.label === 'Slots') {
return value?.split('|');
}
return value?.split('|').map((item) => {
return item.replace(/(\[|\]|<|>).*$/gm, '').trim();
});
return newValue;
},
getParameters(value) {
const newValue = value.split(':').map((item) => {
return item
.replace(/"/g, '')
.replace(/(\[|\]|<|>).*$/gm, '')
.trim();
});
return this.getType(newValue[1]);
},
isLinkType(value) {
if (this.label === 'Slots') return false;
@ -161,3 +150,9 @@ export default {
}
};
</script>
<style scoped>
.parameter-bold {
font-weight: bold;
}
</style>