当前位置:网站首页>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
边栏推荐
- GD32 RT-Thread OTA/Bootloader驱动函数
- 【Rust日报】2021-01-23 几个新库发布
- 透过华为军团看科技之变(五):智慧园区
- Turn to cartoon learning notes
- 华南产业集团发力数字经济,城链科技发布会成功召开
- Leetcode question brushing (I) -- double pointer (go Implementation)
- June training (day 30) - topology sorting
- Tooltips in the era of touch
- Harvester ch1 of CKB and HNS, connection tutorial analysis
- 【Rust每周一库】num-bigint - 大整数
猜你喜欢

Overview of currency

苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...

MySQL log management, backup and recovery of databases (2)

Harvester ch1 of CKB and HNS, connection tutorial analysis
[email protected]体感机械臂"/>技能梳理[email protected]体感机械臂

I found a wave of "alchemy artifact" in the goose factory. The developer should pack it quickly

ArcGIS Pro脚本工具(5)——排序后删除重复项

GeoffreyHinton:我的五十年深度学习生涯与研究心法

郭琳加冕 2022第三季完美大师 全球人气季军

吴恩达2022机器学习专项课测评来了!
随机推荐
今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计
Xinguan has no lover, and all the people benefit from loving deeds to warm the world -- donation to the public welfare action of Shangqiu children's welfare home
ArcGIS Pro + PS 矢量化用地规划图
安徽《合肥市装配式建筑施工图审查设计深度要求》印发;河北衡水市调整装配式建筑预售许可标准
6. Redis new data type
滴滴开源敏捷测试用例管理平台!
WGet -- 404 not found due to spaces in URL
MySQL log management, backup and recovery of databases (1)
Who should the newly admitted miners bow to in front of the chip machine and the graphics card machine
我的远程办公深度体验 | 社区征文
最新SCI影响因子公布:国产期刊最高破46分!网友:算是把IF玩明白了
敏捷开发: 超级易用水桶估计系统
ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
ArcGIS Pro scripting tool (5) - delete duplicates after sorting
Jump table introduction
断路器HystrixCircuitBreaker
The AOV function of R language was used for repeated measures ANOVA (one intra group factor and one inter group factor) and interaction Plot function and boxplot to visualize the interaction
前嗅ForeSpider教程:抽取数据
Gd32 RT thread RTC driver function
ArcGIS Pro脚本工具(6)——修复CAD图层数据源