# 普通用法
点击查看代码
<template>
<div>
<ygp-crud :dic="dic" :data="data" :option="option" @search-change="onLoad"></ygp-crud>
</div>
</template>
export default {
data() {
return {
dic: {
dicData: [
{
label: "男",
value: 0,
},
{
label: "女",
value: 1,
},
],
},
data: [
{
name: "张三",
sex: "男",
date: "1994-02-23 00:00:00",
},
{
name: "李四",
sex: "女",
date: "1994-02-23 00:00:00",
},
{
name: "王五",
sex: "女",
date: "1994-02-23 00:00:00",
},
{
name: "赵六",
sex: "男",
date: "1994-02-23 00:00:00",
},
],
option: {
title: "搜索标题",
labelWidth: "80px",
columns: [
{
label: "姓名",
prop: "name",
search: true,
span: 12,
},
{
label: "性别",
prop: "sex",
search: true,
span: 12,
type: "select",
dicName: "dicData",
options: [],
labelKey: "label",
valueKey: "value",
},
{
label: "日期",
prop: "date",
search: true,
span: 12,
type: "date",
range: true,
},
],
},
};
},
methods: {
onLoad({ pageData, formData }) {
this.$message.success(JSON.stringify(formData));
},
},
};