mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 17:31:02 +08:00
dd65c73870
docs(components): [affix] * Add lost exposed API to documentation. * Refine code. * Add descriptions for APIs. * Refine implementation for `FunctionType` and `EnumType`. * Update affix documentation based on the changes above. Co-authored-by: JeremyWuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com>
38 lines
776 B
Vue
38 lines
776 B
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import ApiTyping from './vp-api-typing.vue'
|
|
|
|
import type { PropType } from 'vue'
|
|
|
|
type ParamType = [string, string]
|
|
|
|
const props = defineProps({
|
|
/**
|
|
* @description params list, shape of Array<[key: string, value: string]>
|
|
*/
|
|
params: {
|
|
type: Array as PropType<Array<ParamType>>,
|
|
default: () => [],
|
|
},
|
|
returns: {
|
|
type: String,
|
|
default: 'void',
|
|
},
|
|
})
|
|
|
|
const mappedParams = computed(() =>
|
|
props.params
|
|
.reduce(
|
|
(params, [key, val]) => params.concat([`${key}: ${val}`]),
|
|
[] as string[]
|
|
)
|
|
.join(', ')
|
|
)
|
|
|
|
const details = computed(() => `(${mappedParams.value}) => ${props.returns}`)
|
|
</script>
|
|
|
|
<template>
|
|
<api-typing type="Function" :details="details" />
|
|
</template>
|