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 childSinature = child.signatures[0];
const parameters = childSinature.parameters.reduce((acc, { name, type }, index) => (index === 0 ? `${name}: ${type.name}` : `${acc}, ${name}: ${type.name}`), ''); 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 { } else {
const childType = child.type.elementType ? child.type.elementType.name : child.type.name; 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> </span>
<template v-else-if="k === 'type'"> <template v-else-if="k === 'type'">
<template v-for="(value, i) in getType(v)" :key="value"> <template v-for="(value, i) in getType(v)" :key="value">
{{ i !== 0 ? ' |' : '' }} {{ i !== 0 ? ' |' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link">{{ value }}</NuxtLink
<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink> ><span v-else>{{ value }}</span>
<span v-else> {{ value }} </span>
</template> </template>
</template> </template>
<template v-else-if="k === 'parameters'"> <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"> <template v-for="(value, i) in getType(v.type)" :key="value">
{{ i !== 0 ? ' |' : '' }} {{ i !== 0 ? ' |' : '' }}<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink>
<NuxtLink v-if="isLinkType(value)" :to="setLinkPath(value)" class="doc-option-link"> {{ value }} </NuxtLink> <span v-else v-html="value"> </span>
<span v-else> {{ value }} </span>
</template> </template>
</template> </template>
@ -86,22 +84,13 @@ export default {
}, },
methods: { methods: {
getType(value) { 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 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) { isLinkType(value) {
if (this.label === 'Slots') return false; if (this.label === 'Slots') return false;
@ -161,3 +150,9 @@ export default {
} }
}; };
</script> </script>
<style scoped>
.parameter-bold {
font-weight: bold;
}
</style>