Skip to content

Commit

Permalink
fix(list): allow clickable list item by setting modelValue to null
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Nov 15, 2022
1 parent e180e7f commit 1c83462
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/anu-vue/src/components/list/AList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const AList = defineComponent({
*/
modelValue: {
type: [String, Number, Object],
default: null,
default: undefined,
},

/**
Expand Down Expand Up @@ -97,7 +97,7 @@ export const AList = defineComponent({
const handleListItemClick = (index: number) => {
const itemValue = options.value[index].value
selectListItem(itemValue)
if (props.modelValue !== null)
if (props.modelValue !== undefined)
emit('update:modelValue', value.value)
}

Expand All @@ -123,10 +123,11 @@ export const AList = defineComponent({
return <li
onClick={() => handleListItemClick(itemIndex)}
style={[...styles.value]}
data-x={String(props.modelValue)}
class={[
'a-list-item',
{ 'opacity-50 pointer-events-none': listItem.disable },
props.modelValue !== null
props.modelValue !== undefined
? [...classes.value, 'cursor-pointer']
: '',
'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',
Expand Down

0 comments on commit 1c83462

Please sign in to comment.