更新插件

This commit is contained in:
神仙都没用 2024-02-04 20:12:59 +08:00
parent 0f9922dbc2
commit 150498c25a
2 changed files with 25 additions and 6 deletions

View File

@ -1,18 +1,37 @@
import { defineComponent } from "vue";
import { PropType, defineComponent } from "vue";
import data from "../data/pca.json";
export default defineComponent({
name: "cl-distpicker",
props: {
props: Object
props: Object,
type: {
type: String as PropType<"pc" | "pca">,
default: "pca"
}
},
setup(props) {
return () => {
return (
<el-cascader
options={data}
clearable
options={data.map((e) => {
if (props.type === "pc") {
return {
...e,
children: e.children.map((a) => {
return {
...a,
children: undefined
};
})
};
}
return e;
})}
props={{ label: "name", value: "name", ...props.props }}
/>
);

View File

@ -4,7 +4,7 @@ import { registerFormHook } from "@cool-vue/crud";
// 注册hook
registerFormHook("pca", (value, { method, form, prop }) => {
if (method == "bind") {
return [form.province, form.city, form.district];
return [form.province, form.city, form.district].filter(Boolean);
} else {
const [province, city, district] = value || [];
form.province = province;
@ -19,8 +19,8 @@ export default (): ModuleConfig => {
label: "省市区选择器",
description: "快速增删改查及一系列辅助组件",
author: "COOL",
version: "1.0.0",
updateTime: "2024-02-01",
version: "1.0.1",
updateTime: "2024-02-04",
demo: [
{
name: "基础用法",