FullCalendar计划程序 - 类型'字符串'不能分配给'EmitterInterface []类型

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FullCalendar计划程序 - 类型'字符串'不能分配给'EmitterInterface []类型相关的知识,希望对你有一定的参考价值。

我正在尝试在Angular 2中实现FullCalendar Scheduler,并且我遵循了以下指定的步骤 -

安装所需的依赖性如下 -

"dependencies": {
   "fullcalendar": "^3.8.0",
    "fullcalendar-scheduler": "^1.9.1",
    "jquery": "^3.2.1",
    "moment": "^2.20.1"
  },
  "devDependencies": {
    "@types/jquery": "^2.0.47"
  }

更新了angular-cli.json如下 -

"styles": [
            "styles.css",
            "../node_modules/bootstrap/dist/css/bootstrap.min.css",
            "../node_modules/fullcalendar/dist/fullcalendar.min.css",
            "../node_modules/fullcalendar-scheduler/dist/scheduler.min.css",
            "../node_modules/primeng/resources/primeng.min.css",
            "../node_modules/primeng/resources/themes/omega/theme.css",
            "../node_modules/font-awesome/css/font-awesome.min.css"
        ],
        "scripts": ["../node_modules/jquery/dist/jquery.js",
            "../node_modules/moment/min/moment.min.js",
            "../node_modules/fullcalendar/dist/fullcalendar.js",
             "../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
        ],

我已经在qazxsw poi和qazxsw poi中导入了依赖项 -

main.ts -

main.ts

app.component.html -

module.ts

app.component.ts

import * as jQuery from "jquery";
(window as any).$ = (window as any).jQuery = jQuery;

我已经解决了jQuery错误中指定的@type / jquery问题,但是我无法编译下面提到的代码错误 -

<div id='calendar'></div>

请找到import { Component } from '@angular/core'; import 'fullcalendar'; import 'fullcalendar-scheduler'; declare let $: any; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { ngOnInit() { $('#calendar').fullCalendar({}); } } 。我已经查看了下面的线程和资源,这些似乎没有解决问题 -

ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (347,6): Type 'string' is not assignable to type 'EmitterInterface[]'. ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (124,27): ']' expected. ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (125,28): ']' expected. ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (125,33): ';' expected. ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (126,28): ']' expected. ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (126,33): ';' expected. full error here

我请求你的帮助。

答案

这应该适合你。你也可以在这里查看git repo https://github.com/fullcalendar/fullcalendar/issues/3991

app.component.ts

fullcalendar & Angular 5

角cli.json:

https://gitlab.com/haque.mdmanzurul/ng-fullcalendar

的package.json

import * as jQuery from 'jquery';
(window as any).jQuery = (window as any).$ = jQuery; // This is needed to resolve issue.
import { Component, OnInit } from '@angular/core';
import 'fullcalendar';

 @Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
 })
 export class AppComponent implements OnInit {
 title = 'My Calendar';

 ngOnInit() {
   $('#calendar').fullCalendar({});
 }
}

以上是关于FullCalendar计划程序 - 类型'字符串'不能分配给'EmitterInterface []类型的主要内容,如果未能解决你的问题,请参考以下文章

fullCalendar - 未捕获的类型错误:无法调用未定义的方法“拆分”

未找到类'MaddHatter LaravelFullcalendar ServiceProvider'

从包类型扩展命名空间

使用 ng-fullcalendar dayClick 时的数据绑定

在 Angular 中为 fullcalendar 获取 API 数据

删除fullCalendar中的所有eventSource