Extend

扩展模块,根据使用情况选择组件,避免资源过大问题

组件

cl-editor-preview

编辑器预览

参数说明类型可选值默认值
title弹窗标题string文本预览
name编辑器名称'monaco' | 'quill' | 'wang'
props组件参数object{ height: 600, disabled: true }

cl-editor-wang

wangopen in new window 富文本编辑器

参数说明类型可选值默认值
modelValue绑定值string
mode类型'default' / 'simple'
height高度string / number400
disabled是否禁用booleanfalse

cl-editor-quill

quillopen in new window 富文本编辑器

参数说明类型可选值默认值
modelValue绑定值string
options配置选项object
height高度string / number400
disabled是否禁用booleanfalse

cl-editor-monaco

monacoopen in new window 代码编辑器

参数说明类型可选值默认值
modelValue绑定值string
options配置选项object
language语言类型stringjson
height高度string / number400
disabled是否禁用booleanfalse

cl-distpicker

cascaderopen in new window 省市区级联选择器。基于 el-cascader,可以使用它的全部参数及方法

cl-export-btn

参数说明类型可选值默认值
filename导出文件名string / function报表
columns列数据array
disabled是否禁用booleanfalse

columns 为必填,可以直接使用 cl-tablecolumns 的配置。

<cl-crud>
	<cl-export-btn :columns="Table?.columns" />
</cl-crud>

自定义请求,配置 data 参数

<cl-crud>
	<cl-export-btn :columns="Table?.columns" :data="onExportData">导出成员清单</cl-export-btn>
</cl-crud>

<script lang="ts" setup>
	function onExportData(params: any) {
		// 任意请求,返回一个数组。下面是一个测试示例
		return service.test.page().then((res) => res.list);
	}
</script>

cl-import-btn

参数说明类型可选值默认值
onConfig配置项,返回 ClForm.Item[]function
onSubmit提交事件,({...data, list}, {done, close, setProgress})
template导入模板 URLstring
tips提示string请按照模版填写信息
limitSize导入的文件大小number10
disabled是否禁用booleanfalse
accetp接收的上传文件类型booleanexcel,csv
<cl-crud>
	<cl-import-btn
		tips="请按照模版填写信息,姓名不能重复"
		:on-submit="onSubmit"
		:on-config="onConfig"
	/>
</cl-crud>

<script lang="ts" setup>
	// 添加额外的表单项
	function onConfig(Form: ClForm.Ref) {
		return [
			{
				label: "选择公司",
				prop: "companyId",
				component: {
					name: "el-select",
					options: [
						{
							label: "COOL",
							value: 1
						},
						{
							label: "神仙",
							value: 2
						}
					]
				}
			}
		];
	}

	// 提交事件,根据自己的情况设置格式和接口
	function onSubmit(data: any, { next, done, setProgress }) {
		service.test
			.add(data)
			.then(() => {
				ElMessage.success("导入成功");
				close();
			})
			.catch((err) => {
				ElMessage.error(err.message);
				done();
			});
	}
</script>
Last Updated: