Crud

cl-switch

开关,cl-table 中使用,值改变时会自动调用 update 接口

参数说明类型可选值默认值
modelValue绑定值number / string / boolean
activeValue选中值number / string / booleantrue
inactiveValue未选值number / string / booleanfalse

下面是在 cl-table 的使用示例:

<template>
	<cl-crud>
		<cl-table ref="Table" />
	</cl-crud>
</template>

<script lang="ts" setup>
	const Table = useTable({
		columns: [
			{
				label: "状态",
				prop: "status",
				component: {
					name: "cl-switch"
				}
			}
		]
	});
</script>

cl-select

下拉选择,设置 prop 会自动刷新列表并带入请求参数 { page: 1, [prop]: value }

参数说明类型可选值默认值
modelValue绑定值string / number
options列表array
prop搜索的请求字段string
labelKey作为 label 唯一标识的键名stringlabel
valueKey作为 value 唯一标识的键名stringvalue
tree树形选择器booleanfalse
allLevelsId是否返回选中层级下的所有值booleanfalse

下面是做筛选的使用示例:

<template>
	<cl-crud>
		<cl-row>
			<cl-select :options="options.status" prop="status" />
		</cl-row>

		<cl-row>
			<cl-table ref="Table" />
		</cl-row>
	</cl-crud>
</template>

<script lang="ts" setup>
	const options = reactive({
		status: [
			{
				label: "成功",
				value: 1,
				type: "success"
			},
			{
				label: "失败",
				value: 0,
				type: "danger"
			}
		]
	});

	const Table = useTable({
		columns: [
			{
				label: "状态",
				prop: "status",
				dict: options.status
			}
		]
	});
</script>

cl-column-custom

cl-table 自定义列。可自行扩展,如拖动排序

参数说明类型可选值默认值
namelocalStorage 存储标识,必填string
columns和 ClTable.Column 一样string

cl-date-text

日期文本显示

参数说明类型可选值默认值
modelValue绑定值string
format日期格式stringYYYY-MM-DD HH:mm:ss

cl-date-picker

日期时间选择器

参数说明类型可选值默认值
modelValue绑定值string
type日期类型stringyear / month / week / date / datetime / datetimerange / daterange / monthrangedate
valueFormat日期格式stringYYYY-MM-DD HH:mm:ss
prop搜索请求的字段string
width宽度string
quickBtn是否显示快速按钮boolean
defaultQuickType快速按钮类型stringday / week / month / yearday
Last Updated: