Skip to content
On this page

基础组件

空状态 Empty

此为全局注册组件

参数说明

参数说明类型默认值
image提示图片stringOSS_COMMON_IMG + 'empty.png'
description描述文字string暂无数据

按钮 Buttons

标准按钮

对应设计稿中的【标准按钮】,可直接使用AButton,在此基础上拓展了类型。

使用说明

由于设计稿中对于按钮的类型已经做了定义,在对照AntD的定义后,重新整理type。具体结合设计稿和下方表格进行对照

比较特殊的一个,设计稿中的删除按钮使用时按照AntD的危险按钮添加danger属性,并设置type为primary即可。

设计类型type
主要按钮primary
次要按钮default
描边按钮stroke
文本按钮text
连接按钮connect
企业级按钮enterprise

文本按钮 TextButton

此为全局注册组件

对应设计稿中的【文本按钮】,同时支持超链接和router-link属性

html
<TextButton type="dark" :to="{name: 'MiniprogramVisitorDetail', params:{id: record.openid}}">
    {{ record.nickname }}
</TextButton>

<TextButton href="https://www.baidu.com" target="_blank" type="danger" size="small" loading>Baidu</TextButton>

参数说明

参数说明类型默认值
size尺寸default large small minidefault
type颜色类型default dark dangerdefault
icon图标namestring
to是否通过router-link跳转object
disabled禁用状态boolean
loading等待状态boolean

图标按钮 IconButton

此为全局注册组件

基于TextButton和a-button封装,对照设计稿图标按钮使用

html
<IconButton title="下载" type="circle" size="small" icon="download-2" @click="downloadReport(record)"></IconButton>

参数说明

未提及的参数说明同TextButton

参数说明类型默认值
icon图标namestring
titletooltip titlestring
type按钮类型,类型对照参考下方图片default stroke text grayLink link circle primarydefault
customClass自定义类名string

An image

InputSearch

此为全局注册组件

由于AntD的Input.Search实现效果与设计稿差距较大,改造困难,故在Input基础上二次封装InputSearch组件

An image

API

其余参数和事件与AInputSearch一致,在此基础上拓展了回车触发search事件的功能。

参数说明类型默认值
light是否使用白色背景boolean
html
<InputSearch v-model:value="params.k" placeholder="搜索昵称/openid"
                     @search="getVisitorList"></InputSearch>

补充

设计稿中小部分搜索使用白色背景,添加类white即可

FilterSelect

此为全局注册组件

⚠️ 虽然加了 $attrs,但是 a-select 的部分 api 可能会有些问题,使用时需要注意

  • 支持 a-select 的插槽写法

  • 仅支持 单选

API

未提及的参数及事件同 a-select

参数说明类型默认值
name筛选器的名称string
value(v-model)当前选中的条目string
optionsoptions 数据,如果设置则不需要手动构造 selectOption 节点array<{value, label, [disabled, key, title]}>
addAll是否需要自动添加 "全部" 配置项booleantrue
defaultSelectAll是否默认选中 “全部”配置项booleantrue
allValue“全部”配置项对应的 value 值stringall
fieldNames自定义节点 label、value 的字段{label: string, value: string}{label: 'label', value: 'value'}
light是否使用白色背景boolean

RangePicker

使用方法同a-range-picker,该组件对设计稿中的分隔符和图标等进行了替换,同时对没有确定按钮的情况进行了处理,在面板关闭时触发事件,暂时可等价为确定按钮的点击事件。

javascript
import RangePicker from '@/views/components/common/RangePicker.vue'
html
<RangePicker v-model:value="range" :allow-clear="false" @openHide="emits('change', range)"></RangePicker>

Tag标签

ColorTag

DotTag

vue
<template>
  <DotTag type="success">已审核</DotTag>
</template>
<script lang="ts" setup>
  import DotTag from "@/views/components/tags/DotTag.vue"
</script>

参数说明

参数说明类型默认值
size尺寸default large smalldefault
typedot类型danger warning success info fill-

StatusTag

vue
<template>
  <StatusTag type="success">已审核</StatusTag>
</template>
<script lang="ts" setup>
  import StatusTag from "@/views/components/tags/StatusTag.vue"
</script>

参数说明

参数说明类型默认值
size尺寸default large smalldefault
type状态类型,主要影响icon和颜色failed warning success processing info defaultdefault
icon自定义icon,颜色跟随type,未指定时跟随type里的图标string

IconRadioGroup

vue
<template>
  <IconRadioGroup
      :options="[Position.left, Position.right]"
      v-model:value="value.content.style.logo.position"></IconRadioGroup>
</template>
<script lang="ts" setup>
  import DotTag from "@/views/components/common/IconRadioGroup.vue"
</script>

参数说明

参数说明类型默认值
valuev-model:valueKey
options提供的选项{ label: string, value: Key, icon?: string }[]

OptionalSelect

根据参数可以控制渲染radio还是checkbox,可以用来代替radio-group或checkbox-group

vue
<template>
    <OptionalSelect
        v-model:selectedValues="selectedValues"
        :multiple="multiple"
        :value="item.memberId">
        <img :src="item.thumb_avatar" alt="" width="32" class="rounded-full mr-3 ml-2" />
        {{ item.name }}
    </OptionalSelect>
</template>
<script lang="ts" setup>
    import OptionalSelect from "@/views/components/common/OptionalSelect.vue"
</script>

参数说明

参数说明类型默认值
multiplefalse渲染radio,true渲染checkboxbooleanfalse
selectedValues选中的keyKey[]
valuekeyKey