Javascript 我可以拖动,但不能在fullcalendar中拖放外部事件

Javascript 我可以拖动,但不能在fullcalendar中拖放外部事件,javascript,jquery,angular,fullcalendar,Javascript,Jquery,Angular,Fullcalendar,我在angular 4中使用jQueryUI1.12.1和fullcalendar.js3.4。我可以在屏幕上拖动事件,但当我尝试在日历上拖放事件时,drop属性不会启动,事件只会恢复 以下是我的代码部分: HTML: 有人知道我为什么不能放弃外部事件吗?谢谢。经过大量研究,这就是我所做的,而且fullcalendar工作得非常完美 首先,您必须从npm安装jquery和jquery ui npm安装jquery--保存 npm安装jquery ui保存 从网站下载jqueryui,并将其放入我

我在angular 4中使用jQueryUI1.12.1和fullcalendar.js3.4。我可以在屏幕上拖动事件,但当我尝试在日历上拖放事件时,drop属性不会启动,事件只会恢复

以下是我的代码部分:

HTML:


有人知道我为什么不能放弃外部事件吗?谢谢。

经过大量研究,这就是我所做的,而且fullcalendar工作得非常完美

首先,您必须从npm安装jquery和jquery ui

npm安装jquery--保存

npm安装jquery ui保存

从网站下载
jqueryui
,并将其放入我必须创建的
节点模块/jqueryui/dist/

然后将所有css和js文件从index.html移动到angular-cli.json。这就是我的angular-cli.json的外观:

  "styles": [
    "../node_modules/bootstrap/dist/css/bootstrap.css",
    "../node_modules/fullcalendar/dist/fullcalendar.min.css",
    "styles.scss"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.js",
    "../node_modules/jquery-ui/dist/jquery-ui.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.js",
    "../node_modules/moment/min/moment.min.js",
    "../node_modules/fullcalendar/dist/fullcalendar.min.js",
    "../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
  ]
calendar.component.ts中添加

declare var$:any;
从“时刻”导入*作为时刻

在html中使用

这将允许您将jquery ui用于可拖动/可拖放事件。
我希望这对某人有帮助

经过大量研究,这就是我所做的,fullcalendar工作得非常完美

首先,您必须从npm安装jquery和jquery ui

npm安装jquery--保存

npm安装jquery ui保存

从网站下载
jqueryui
,并将其放入我必须创建的
节点模块/jqueryui/dist/

然后将所有css和js文件从index.html移动到angular-cli.json。这就是我的angular-cli.json的外观:

  "styles": [
    "../node_modules/bootstrap/dist/css/bootstrap.css",
    "../node_modules/fullcalendar/dist/fullcalendar.min.css",
    "styles.scss"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.js",
    "../node_modules/jquery-ui/dist/jquery-ui.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.js",
    "../node_modules/moment/min/moment.min.js",
    "../node_modules/fullcalendar/dist/fullcalendar.min.js",
    "../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
  ]
calendar.component.ts中添加

declare var$:any;
从“时刻”导入*作为时刻

在html中使用

这将允许您将jquery ui用于可拖动/可拖放事件。
我希望这对某人有帮助

如果您从DragTables中删除
revert:true
,会发生什么情况?我没有尝试删除revert,但如果我将其设置为false,则它将停留在屏幕上,无论我将其放置在何处。请您制作一个StackSnippet或JSFIDLE来演示该问题,好吗?可能是一些细节,但如果没有一个工作环境,很难尝试并说出问题的具体原因。您还可以尝试将日历缩减为fullCalendar示例中所示的代码,然后再添加其他选项、内容等,直到它再次停止工作。我解决了这个问题,将所有js文件从index.html移动到anuglar-cli.json。我也停止使用标签,并将其替换为。当我使用该组件时,日历被调用了两次。当我符合条件时,我将发布解决方案。谢谢你的帮助!没问题。很高兴你解决了。我经常发现,缩小这种奇怪问题的最佳方法是从已知可行的最简单代码开始,然后逐渐增加复杂性,直到出现问题。然后你通常知道你的问题从哪里开始。使调试更容易!如果您从DragTables中删除
revert:true
,会发生什么情况?我没有尝试删除revert,但如果我将其设置为false,则它将停留在屏幕上,无论我将其放置在何处。请您制作一个StackSnippet或JSFIDLE来演示该问题,好吗?可能是一些细节,但如果没有一个工作环境,很难尝试并说出问题的具体原因。您还可以尝试将日历缩减为fullCalendar示例中所示的代码,然后再添加其他选项、内容等,直到它再次停止工作。我解决了这个问题,将所有js文件从index.html移动到anuglar-cli.json。我也停止使用标签,并将其替换为。当我使用该组件时,日历被调用了两次。当我符合条件时,我将发布解决方案。谢谢你的帮助!没问题。很高兴你解决了。我经常发现,缩小这种奇怪问题的最佳方法是从已知可行的最简单代码开始,然后逐渐增加复杂性,直到出现问题。然后你通常知道你的问题从哪里开始。使调试更容易!
  "styles": [
    "../node_modules/bootstrap/dist/css/bootstrap.css",
    "../node_modules/fullcalendar/dist/fullcalendar.min.css",
    "styles.scss"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.js",
    "../node_modules/jquery-ui/dist/jquery-ui.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.js",
    "../node_modules/moment/min/moment.min.js",
    "../node_modules/fullcalendar/dist/fullcalendar.min.js",
    "../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
  ]