当前位置:网站首页>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
边栏推荐
- js常见问题
- How to seize the opportunity of NFT's "chaos"?
- Using LVM to resize partitions
- Launch of Rural Revitalization public welfare fund and release of public welfare bank for intangible cultural heritage protection of ancient tea tree
- Notes on numerical calculation - iterative solution of linear equations
- The latest SCI impact factor release: the highest score of domestic journals is 46! Netizen: I understand if
- Input a decimal data, convert to 8, using the sequence stack
- Jump table introduction
- GD32 RT-Thread PWM驱动函数
- South China Industrial Group launched digital economy and successfully held the city chain technology conference
猜你喜欢

那个程序员,被打了。

今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计

Compétences Comb 27 @ Body sense Manipulator

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

“昆明城市咖啡地圖”活動再度開啟

戴森设计大奖,以可持续化设计改变世界

South China Industrial Group launched digital economy and successfully held the city chain technology conference

The preliminary round of the sixth season of 2022 perfect children's model Hefei competition area was successfully concluded

The latest SCI impact factor release: the highest score of domestic journals is 46! Netizen: I understand if

MySQL advanced SQL statement of database (2)
随机推荐
技能梳理[email protected]体感机械臂
CVPR 2022 | 清华&字节&京东提出BrT:用于视觉和点云3D目标检测的桥接Transformer
[ark UI] implementation of the startup page of harmoniyos ETS
Skill sorting [email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled
郭琳加冕 2022第三季完美大师 全球人气季军
R语言plotly可视化:使用plotly可视化多分类模型的预测置信度、模型在2D网格中每个数据点预测的置信度、置信度定义为在某一点上最高分与其他类别得分之和之间的差值
MySQL advanced SQL statement of database (2)
记一次实习的经历,趟坑必备(一)
Using LVM to resize partitions
Musk has more than 100 million twitter fans, but he has been lost online for a week
MySQL index, transaction and storage engine of database (2)
【深度学习】深度学习检测小目标常用方法
TypeScript–es5中的类,继承,静态方法
ArcGIS Pro脚本工具(6)——修复CAD图层数据源
MySQL advanced SQL statement of database (1)
技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
Koreano essential creates a professional style
逸仙电商发布一季报:坚持研发及品牌投入,实现可持续高质量发展
透过华为军团看科技之变(五):智慧园区
L'activité "Kunming City coffee map" a rouvert