Coder Social home page Coder Social logo

Comments (10)

jd-solanki avatar jd-solanki commented on July 19, 2024 1

Hi @soulsam480

Why do you need default slot?

You might be looking for item slot to render the custom content inside the list item, right?

from anu.

jd-solanki avatar jd-solanki commented on July 19, 2024 1

Hi @soulsam480

item prop be super flexible

prop or slot?

if your gihub sponsors is open, would love to contribute some

Thanks for the honor. I will open sponsorship later but first I want to provide some value via this framework.

Regarding the last reply, I pushed new commit that:

  • Allows item slot so that you can customize the list item rendering. item slot provides item & index as slot props.

Source code

I hope this will resolve this issue. Have you checked the anu with latest update (I haven't released the change yet but you can try master branch)

Awaiting your response.

from anu.

soulsam480 avatar soulsam480 commented on July 19, 2024 1

prop or slot?

Ah sorry, I meant a slot.

I hope this will resolve this issue. Have you checked the anu with latest update (I haven't released the change yet but you can try master branch)

Awaiting your response.

Just checked, super work. I think this solves my thing. thx for your work again.

from anu.

soulsam480 avatar soulsam480 commented on July 19, 2024

I suspect the error is coming from here

options: props.items[0].value ? props.items.map(i => i.value) : props.items.length,
. Please tell me how can I help.

from anu.

jd-solanki avatar jd-solanki commented on July 19, 2024

Maybe we have to do:

- props.items[0].value ? props.items.map(i => i.value) : props.items.length
+ props.items && props.items[0].value ? props.items.map(i => i.value) : props.items.length

However, we might have to take care of other things like click:

const handleListItemClick = (index: number) => {

from anu.

jd-solanki avatar jd-solanki commented on July 19, 2024

Maybe I should learn how to write tests now

from anu.

jd-solanki avatar jd-solanki commented on July 19, 2024

@soulsam480 I'm on it

from anu.

jd-solanki avatar jd-solanki commented on July 19, 2024

Closed via 467f8df

from anu.

soulsam480 avatar soulsam480 commented on July 19, 2024

Hi @soulsam480

Why do you need default slot?

You might be looking for item slot to render the custom content inside the list item, right?

@jd-solanki Yessir correct. Also the current API design is great, but in terms of flexibility, I think we can do better. e.g. in a list along with prepend and append slots, an item prop be super flexible. I think you already know this, but taking some inspiration from the API design of Quasar will be a great idea as it's the holy grail of vue component lib IMO. anyways awesome work, if your gihub sponsors is open, would love to contribute some.

from anu.

soulsam480 avatar soulsam480 commented on July 19, 2024

Maybe we have to do:

- props.items[0].value ? props.items.map(i => i.value) : props.items.length
+ props.items && props.items[0].value ? props.items.map(i => i.value) : props.items.length

However, we might have to take care of other things like click:

const handleListItemClick = (index: number) => {

I think this will still fail, if the items array is empty, i.e. first item is undefined and the error will be can't read property value of undefined. fix can be making it an optional chain e.g.

 props.items && props.items[0]?.value ? props.items.map(i => i.value) : props.items.length

from anu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.