fix: formCreate 组件用户选择器,用户选中问题
parent
2568b4dcda
commit
f3b83990ad
|
@ -186,6 +186,12 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const buildSelect = () => {
|
const buildSelect = () => {
|
||||||
|
const {
|
||||||
|
modelValue,
|
||||||
|
'onUpdate:modelValue': onUpdateModelValue,
|
||||||
|
...restAttrs
|
||||||
|
} = attrs;
|
||||||
|
|
||||||
if (props.multiple) {
|
if (props.multiple) {
|
||||||
// fix:多写此步是为了解决 multiple 属性问题
|
// fix:多写此步是为了解决 multiple 属性问题
|
||||||
return (
|
return (
|
||||||
|
@ -193,7 +199,9 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
class="w-full"
|
class="w-full"
|
||||||
loading={loading.value}
|
loading={loading.value}
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
{...attrs}
|
onUpdate:value={onUpdateModelValue as any}
|
||||||
|
value={modelValue as any}
|
||||||
|
{...restAttrs}
|
||||||
// TODO: remote 对等实现
|
// TODO: remote 对等实现
|
||||||
// remote={props.remote}
|
// remote={props.remote}
|
||||||
{...(props.remote && { remoteMethod })}
|
{...(props.remote && { remoteMethod })}
|
||||||
|
@ -212,7 +220,9 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
<Select
|
<Select
|
||||||
class="w-full"
|
class="w-full"
|
||||||
loading={loading.value}
|
loading={loading.value}
|
||||||
{...attrs}
|
onUpdate:value={onUpdateModelValue as any}
|
||||||
|
value={modelValue as any}
|
||||||
|
{...restAttrs}
|
||||||
// TODO: @dhb52 remote 对等实现, 还是说没作用
|
// TODO: @dhb52 remote 对等实现, 还是说没作用
|
||||||
// remote={props.remote}
|
// remote={props.remote}
|
||||||
{...(props.remote && { remoteMethod })}
|
{...(props.remote && { remoteMethod })}
|
||||||
|
@ -228,6 +238,11 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const buildCheckbox = () => {
|
const buildCheckbox = () => {
|
||||||
|
const {
|
||||||
|
modelValue,
|
||||||
|
'onUpdate:modelValue': onUpdateModelValue,
|
||||||
|
...restAttrs
|
||||||
|
} = attrs;
|
||||||
if (isEmpty(options.value)) {
|
if (isEmpty(options.value)) {
|
||||||
options.value = [
|
options.value = [
|
||||||
{ label: '选项1', value: '选项1' },
|
{ label: '选项1', value: '选项1' },
|
||||||
|
@ -235,7 +250,12 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<CheckboxGroup class="w-full" {...attrs}>
|
<CheckboxGroup
|
||||||
|
class="w-full"
|
||||||
|
onUpdate:value={onUpdateModelValue as any}
|
||||||
|
value={modelValue as any}
|
||||||
|
{...restAttrs}
|
||||||
|
>
|
||||||
{options.value.map(
|
{options.value.map(
|
||||||
(item: { label: any; value: any }, index: any) => (
|
(item: { label: any; value: any }, index: any) => (
|
||||||
<Checkbox key={index} value={item.value}>
|
<Checkbox key={index} value={item.value}>
|
||||||
|
@ -247,6 +267,11 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const buildRadio = () => {
|
const buildRadio = () => {
|
||||||
|
const {
|
||||||
|
modelValue,
|
||||||
|
'onUpdate:modelValue': onUpdateModelValue,
|
||||||
|
...restAttrs
|
||||||
|
} = attrs;
|
||||||
if (isEmpty(options.value)) {
|
if (isEmpty(options.value)) {
|
||||||
options.value = [
|
options.value = [
|
||||||
{ label: '选项1', value: '选项1' },
|
{ label: '选项1', value: '选项1' },
|
||||||
|
@ -254,7 +279,12 @@ export const useApiSelect = (option: ApiSelectProps) => {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<RadioGroup class="w-full" {...attrs}>
|
<RadioGroup
|
||||||
|
class="w-full"
|
||||||
|
onUpdate:value={onUpdateModelValue as any}
|
||||||
|
value={modelValue as any}
|
||||||
|
{...restAttrs}
|
||||||
|
>
|
||||||
{options.value.map(
|
{options.value.map(
|
||||||
(item: { label: any; value: any }, index: any) => (
|
(item: { label: any; value: any }, index: any) => (
|
||||||
<Radio key={index} value={item.value}>
|
<Radio key={index} value={item.value}>
|
||||||
|
|
Loading…
Reference in New Issue