Closed mintong89 closed 5 months ago
Is there any ways to let vanX.list only looping non-deleted values? For example if there are items deleted, the array value will show as:
console.log(apples) >> [[Target]]: Array(4) >> ... >> Symbol(): (4) [empty × 2, 'apple', 'apple', ...]
Then when I want to create elements using vanX.list with using index key, it will show like this:
vanX.list(van.tags.ol, apples, (apple, deleter, index) => van.tags.li(index))
<ol> <li>2</li> <li>3</li> </ol>
But what I want is
<ol> <li>0</li> <li>1</li> </ol>
Is there any way to acheive it like adding filter(Boolean) on vanX.list?
filter(Boolean)
You can add this line:
vanX.replace(apples, items => items)
This will eliminate all the holes in your reactive array apples.
apples
alright thanks for your solution!
Is there any ways to let vanX.list only looping non-deleted values? For example if there are items deleted, the array value will show as:
Then when I want to create elements using vanX.list with using index key, it will show like this:
But what I want is
Is there any way to acheive it like adding
filter(Boolean)
on vanX.list?