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

SpeedDial v2: Cannot use Scoped Slot to customize items #2889

Closed
service-paradis opened this issue Aug 24, 2022 · 3 comments
Closed

SpeedDial v2: Cannot use Scoped Slot to customize items #2889

service-paradis opened this issue Aug 24, 2022 · 3 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working vue2
Milestone

Comments

@service-paradis
Copy link

service-paradis commented Aug 24, 2022

Describe the bug

When looking at the Slots section of the SpeedDial documentantion, we see that we could customize the items. To do this, we need to receive the item information. Unfortunately, there is an error in the codebase which make this impossible to use while receiving item information.

I can customize the item if I use the following, but without information about the item, every item will look the same...

  <SpeedDial :model="model" :type="type" :direction="direction">
    <template #item>
      my custom item
    </template>
  </SpeedDial>

If I use the following, which is what we expect to use, it does not work

  <SpeedDial :model="model" :type="type" :direction="direction">
    <template #item="itemProps">
      {{ itemProps.item.label }}
    </template>
  </SpeedDial>

The problem can be fixed in this file:
https://github.com/primefaces/primevue/blob/2.x/src/components/speeddial/SpeedDial.vue#L9

v-if="!$slots.item" should be v-if="!$slots.item && !$scopedSlots.item"

Reproducer

No response

PrimeVue version

2.10.0

Vue version

2.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. Try to customize SpeedDial items using scoped slots with something like:
  <SpeedDial :model="model" :type="type" :direction="direction">
    <template #item="itemProps">
      {{ itemProps.item.label }}
    </template>
  </SpeedDial>
  1. Look at the rendered component that do not use your custom code

Expected behavior

We should be able to receive the items information when using the scoped slots to customize the look of items in the SpeedDial component.

@service-paradis service-paradis added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 24, 2022
@bahadirsofuoglu
Copy link
Contributor

bahadirsofuoglu commented Aug 25, 2022

Hi,
You can try the below solution. The reason for this problem is the prop named 'item' used by the dynamic component.

Edit: Sorry for my mistake. I checked for Vue 3. v-if="!$slots.item && !$scopedSlots.item" solution works for Vue2. After release, you can use the below.

<SpeedDial :model="items" direction="up"> <template #item="itemProps"> {{ itemProps.item.label }} </template> </SpeedDial>

@bahadirsofuoglu bahadirsofuoglu removed the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 25, 2022
@mertsincan mertsincan reopened this Aug 25, 2022
@bahadirsofuoglu bahadirsofuoglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 25, 2022
@bahadirsofuoglu bahadirsofuoglu added this to the 2.11.0 milestone Aug 25, 2022
@service-paradis
Copy link
Author

Thank you @bahadirsofuoglu!

@tugcekucukoglu
Copy link
Member

Fixed with #2890

tugcekucukoglu added a commit that referenced this issue Sep 2, 2022
@tugcekucukoglu tugcekucukoglu changed the title SpeedDial: Cannot use Scoped Slot to customize items SpeedDial v2: Cannot use Scoped Slot to customize items Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working vue2
Projects
None yet
Development

No branches or pull requests

4 participants