Skip to content

Commit

Permalink
fix(selection): set defaultValue be null.
Browse files Browse the repository at this point in the history
  • Loading branch information
chizuki committed Nov 26, 2022
1 parent f12b2e6 commit fb6c084
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/hoci/src/components/selection/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { syncRef } from "@vueuse/core";
import { isDefined, syncRef } from "@vueuse/core";
import type { PropType } from "vue";
import { computed, defineComponent, h, provide, reactive, renderSlot } from "vue";
import type { ActivateEvent } from "../../types";
Expand All @@ -13,14 +13,15 @@ export const selectionListProps = defineHookProps({
default: "div"
},
modelValue: {
type: valuePropType
type: valuePropType,
default: () => null
},
/**
* 选中时的 class
*/
activeClass: {
type: classPropType,
default: ""
default: "active"
},
/**
* 每个选项的 class
Expand Down Expand Up @@ -51,7 +52,8 @@ export const selectionListProps = defineHookProps({
type: Boolean
},
defaultValue: {
type: valuePropType
type: valuePropType,
default: () => null
},
activateEvent: {
type: String as PropType<ActivateEvent>,
Expand All @@ -68,7 +70,7 @@ export const useSelectionList = defineHookComponent({
const options = reactive<Option[]>([]);

function toArray(value?: any | any[]): any[] {
if (value === undefined) {
if (!isDefined(value)) {
return [];
}
if (props.multiple && Array.isArray(value)) {
Expand Down

0 comments on commit fb6c084

Please sign in to comment.