如何在Ionic 4/5中拖动元素 [英] How to drag elements in Ionic 4/5

查看:159
本文介绍了如何在Ionic 4/5中拖动元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Ionic中创建可拖动的(免费)按钮。在ionic 3中,我使用了指令来执行此操作(链接 https://www.joshmorony.com/building-an-absolute-drag-directive-in-ionic-2/ ),但该指令在ionic 5中无效,并且不会产生任何错误。您认为用于ionic 5的最佳库(某些教程支持)是什么?

I would like to create draggable (free) buttons in Ionic. In ionic 3 I used a directive to do this (link https://www.joshmorony.com/building-an-absolute-drag-directive-in-ionic-2/) but this directive don't works in ionic 5 and it does not give any errors. What do you think is the best library (supported from some tutorial) for ionic 5 to do this? Thanks in advance.

推荐答案

这不一定是特定于离子的。如果您使用的是角度,则可以使用NPM组件,例如 https:// www。 npmjs.com/package/angular-draggable-droppable

This does not have to be Ionic specific. If you are using angular you can just use an NPM component such as https://www.npmjs.com/package/angular-draggable-droppable

Angular Material库中也对此提供支持

There is also support for this in Angular Material library

https://material.angular.io/cdk/drag-drop/overview

这篇关于如何在Ionic 4/5中拖动元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆