Skip to content

Commit 1c83462

Browse files
committed
fix(list): allow clickable list item by setting modelValue to null
1 parent e180e7f commit 1c83462

File tree

1 file changed

+4
-3
lines changed
  • packages/anu-vue/src/components/list

1 file changed

+4
-3
lines changed

packages/anu-vue/src/components/list/AList.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const AList = defineComponent({
5959
*/
6060
modelValue: {
6161
type: [String, Number, Object],
62-
default: null,
62+
default: undefined,
6363
},
6464

6565
/**
@@ -97,7 +97,7 @@ export const AList = defineComponent({
9797
const handleListItemClick = (index: number) => {
9898
const itemValue = options.value[index].value
9999
selectListItem(itemValue)
100-
if (props.modelValue !== null)
100+
if (props.modelValue !== undefined)
101101
emit('update:modelValue', value.value)
102102
}
103103

@@ -123,10 +123,11 @@ export const AList = defineComponent({
123123
return <li
124124
onClick={() => handleListItemClick(itemIndex)}
125125
style={[...styles.value]}
126+
data-x={String(props.modelValue)}
126127
class={[
127128
'a-list-item',
128129
{ 'opacity-50 pointer-events-none': listItem.disable },
129-
props.modelValue !== null
130+
props.modelValue !== undefined
130131
? [...classes.value, 'cursor-pointer']
131132
: '',
132133
'flex items-center gap-$a-list-item-gap m-$a-list-item-margin p-$a-list-item-padding min-h-$a-list-item-min-height',

0 commit comments

Comments
 (0)