mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
更新插件
This commit is contained in:
parent
0f9922dbc2
commit
150498c25a
@ -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 }}
|
||||
/>
|
||||
);
|
||||
|
@ -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: "基础用法",
|
||||
|
Loading…
Reference in New Issue
Block a user