ionic-team / ionic-team/ionic-docs

content: add example of event binding to ion-item-sliding

Đang mở
#4,271 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
content
Ngôn ngữ chính
MDX
Star
621
Fork
3.2k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
86

Mô tả

### Describe Problem

https://ionic-docs-o31kiyk8l-ionic1.vercel.app/docs/v8/api/item-sliding#basic-usage

The basic usage does example the template part only, but it is really unclear how to make this work with the logic part (especially for beginners, when you have no idea how things work)
Some primary issues:
1. How to bind the simple click event of the option to the function of component class
2. How to bind the 'overslide' - i.e. when user drags the sliding item far from the starting point, so the last option will trigger automatically on slide release

### Describe Preferred Solution

I've spent some time to make an example of Arhive-Delete drag with working template, so dragging/clicking Archive or delete is actually works and reflects the data:

https://stackblitz.com/edit/angular-t9fwgq5c?file=src%2Fapp%2Fexample.component.ts

I may not be perfect because I also don't know the right approach for good overslide

### Describe Alternatives

Take a look at angular material documentation for MatTable (or just look for other components) as an example:
https://material.angular.dev/components/table/examples

It has first example as basic usage, and more use cases for every matter you can think of.

### Additional Information

There is a subtle note on ionSwipe https://ionic-docs-o31kiyk8l-ionic1.vercel.app/docs/v8/api/item-sliding#expandable-options, but ionSwipe does not work for me (or at least on PC Web version which I develop and test on)

And I usually check the code, skipping the reading part (I don't think I am the only person who skips text)

So trivial task like 'copy-paste' of a working example turns into pain in the ass, requiring to spend time researching...

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.