import { upperFirst } from 'lodash/string'; import { ApiEntity } from '@/views/entity/demoentity'; import { IMAGE, ALT } from '@/views/common/constant'; const sizes = ['', 'large', '16', '18']; const base: ApiEntity = { title: '超链尺寸', desc: '超链分两种尺寸。通过属性 size 进行设置,可选值有 large 16 18 。', code: sizes.reduce( (acc: string, size: string, index: number) => `${acc}\n ${ALT}这是个超链 ${upperFirst( size ) || 'Default'}\n${ index < sizes.length - 1 ? '\n
\n' : '' }`, '' ), }; export default base;