Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[w-accordion] unexpected close while updating elements #140

Open
alessandrodipierro opened this issue Feb 3, 2024 · 0 comments
Open

[w-accordion] unexpected close while updating elements #140

alessandrodipierro opened this issue Feb 3, 2024 · 0 comments

Comments

@alessandrodipierro
Copy link

alessandrodipierro commented Feb 3, 2024

If while using the W-Accordion component you update a property of the elements over which the component is looping, the automatic closing of the elements is triggered.
Is it wanted?

Here the example snippet:

<script setup lang="ts">
import { getSchedule } from '@/api/scheduleService'
import { ref, watch } from 'vue'

interface Props {
  scheduleId: string;
}

const props = defineProps<Props>()
const { schedule } = await getSchedule(props.scheduleId)

const updateProperty = <T, K extends keyof T>(obj: T, key: K, value: T[K]) => {
  obj[key] = value
}

</script>

<template>
  <w-card shadow class="mx10 mb3 mt4">
    <w-accordion :items="schedule.guests"  expand-icon="wi-plus" collapse-icon="wi-minus" expand-single>
      <template #item-content="{ item }">
        <w-input type="text" label="Firstname" :model-value="item.firstname"
                 @update:model-value="value => updateProperty(item, 'firstname', value)" />
      </template>
    </w-accordion>
  </w-card>

</template>

<style scoped>

</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant