当前位置:网站首页>Ionic4 drag the ion reorder group component to change the item order
Ionic4 drag the ion reorder group component to change the item order
2022-06-30 10:38:00 【Full stack programmer webmaster】
2018 stay ionic There are many components used in the project , This article talks about ion-reorder-group Use of this component . At first I didn't know ionic4 The drag and drop sorting component has been encapsulated in , The supervisor told me . The experience of using this component tells me : Read the official documents carefully , That's right ! HTML Components used in , The code is as follows
<!-- One sort combines one ion-reorder-group-->
<ion-reorder-group [disabled]="false" (ionItemReorder)="reorder($event)">
<ion-item color="tertiary" *ngFor="let field of fieldList,let i=index">
<ion-label>{
{ field.name}}</ion-label>
<!-- Drag the button -->
<ion-reorder slot="end"></ion-reorder>
</ion-item>
</ion-reorder-group>ionItemReorder binding reorder event , yes item The event that will be triggered when being dragged , This incident is ionic Binding in IonReorderGroup On the component . Remember to set disabled attribute , Otherwise, there will be no drag button .
reorder(ev) {
try {
if (ev.detail.to === this.fieldList.length) {
ev.detail.to -= 1;
}
if (ev.detail.from < ev.detail.to) {
this.fieldList.splice(ev.detail.to + 1, 0, this.fieldList[ev.detail.from]);
this.fieldList.splice(ev.detail.from, 1);
}
if (ev.detail.from > ev.detail.to) {
this.fieldList.splice(ev.detail.to, 0, this.fieldList[ev.detail.from]);
this.fieldList.splice(ev.detail.from + 1, 1);
}
ev.detail.complete();
} catch (e) {
return;
}
}customEvent Inherited from Event, Added detail attribute , contain from,to,complete, Record the front and back of the dragged item respectively index,complete Method needs to be called after dragging , Otherwise it will get stuck .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/101149.html Link to the original text :https://javaforall.cn
边栏推荐
- Test memory read rate
- Apple's 5g chip was revealed to have failed in research and development, and the QQ password bug caused heated discussion. Wei Lai responded to the short selling rumors. Today, more big news is here
- CSDN daily one practice 2021.11.06 question 1 (C language)
- The digital collection of sunanmin's lotus heart clearing was launched on the Great Wall Digital Art
- MATLAB image histogram equalization, namely spatial filtering
- 那个程序员,被打了。
- Use keil5 software to simulate and debug gd32f305 from 0
- Kernel linked list (general linked list) "list.h" simple version and individual comments
- MySQL log management, backup and recovery of databases (1)
- 机器学习面试准备(一)KNN
猜你喜欢

Deploy lvs-dr cluster

Migrate full RT thread to gd32f4xx (detailed)

透过华为军团看科技之变(五):智慧园区

Yixian e - commerce publie un rapport trimestriel: adhérer à la R & D et à l’investissement de la marque, réaliser un développement durable et de haute qualité

打通供应链 深圳礼品展助跨境电商寻破局之道
[email protected]+adxl345+ Motor vibration + serial port output"/>Skill sorting [email protected]+adxl345+ Motor vibration + serial port output

Dow Jones Industrial Average

Remember the experience of an internship. It is necessary to go to the pit (I)

机器学习面试准备(一)KNN

"Kunming City coffee map" activity was launched again
随机推荐
逸仙電商發布一季報:堅持研發及品牌投入,實現可持續高質量發展
逸仙电商发布一季报:坚持研发及品牌投入,实现可持续高质量发展
六月集训(第30天) —— 拓扑排序
The performance of arm's new CPU has been improved by 22%, up to 12 cores can be combined, and the GPU is first equipped with hardware optical tracking. Netizen: the gap with apple is growing
Kernel linked list (general linked list) "list.h" simple version and individual comments
Skill combing [email protected] intelligent instrument teaching aids based on 51 series single chip microcomputer
ionic4 ion-reorder-group组件拖拽改变item顺序
mysql数据库基础:存储过程和函数
GD32 RT-Thread DAC驱动函数
Gd32 RT thread PWM drive function
Action bright: take good care of children's eyes together -- a summary of the field investigation on the implementation of action bright in Guangxi
I found a wave of "alchemy artifact" in the goose factory. The developer should pack it quickly
技能梳理[email protected]在oled上控制一条狗的奔跑
潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
透过华为军团看科技之变(五):智慧园区
About Library (function library), dynamic library and static library
我在鹅厂淘到了一波“炼丹神器”,开发者快打包
Overview of currency
Leetcode question brushing (I) -- double pointer (go Implementation)
Gd32 RT thread DAC driver function