首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误TS2305:模块“完整日历”没有导出的成员“选项”。角度

错误TS2305:模块“完整日历”没有导出的成员“选项”。角度
EN

Stack Overflow用户
提问于 2018-03-26 12:16:01
回答 1查看 2K关注 0票数 0

我在角5中使用fullCalendar &它的全日历调度程序。

app.module.ts

代码语言:javascript
复制
    import { CalendarModule } from "ap-angular2-fullcalendar";
@NgModule({
  imports: [
    CalendarModule,

home.component.ts

代码语言:javascript
复制
    import { CalendarComponent } from 'ap-angular2-fullcalendar';
    import * as $ from 'jquery';
    import 'fullcalendar';
    import 'fullcalendar-scheduler';

export class HomeComponent implements OnInit {

 calendarOptions: Object = {
    defaultView: 'agendaDay',

    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    resources: [
      { id: 'a', title: 'Resource 1' },
      { id: 'b', title: 'Resource 2', eventColor: 'green' },
      { id: 'c', title: 'Resource 3', eventColor: 'orange' },
      { id: 'd', title: 'Resource 4', eventColor: 'red' }
    ],
    events: [
      { id: '1', resourceId: 'a', start: '2018-03-07T09:00:00', end: '2018-03-07T10:00:00', title: 'event 1' },
      { id: '2', resourceId: 'b', start: '2018-03-07T07:30:00', end: '2018-03-07T08:30:00', title: 'event 2' },
      { id: '3', resourceId: 'c', start: '2018-03-07T07:30:00', end: '2018-03-07T08:30:00', title: 'event 3' },
      { id: '4', resourceId: 'd', start: '2018-03-07T10:10:00', end: '2018-03-07T10:40:00', title: 'event 4' },
      { id: '5', resourceId: 'a', start: '2018-03-07T10:10:00', end: '2018-03-07T10:40:00', title: 'event 5' }
    ]
  };

我收到以下错误:

node_modules/ap-angular2-fullcalendar/src/calendar/calendar.d.ts(3,10):错误TS2305中的错误:模块“完整日历”没有导出的成员“选项”。node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(2525,10):error TS2717:后续属性声明必须具有相同的类型。属性'fullCalendar‘必须是'Calendar’类型,但是这里有'object‘类型。

在……上面

代码语言:javascript
复制
ng build

This solution does not worked for me

package.json

代码语言:javascript
复制
 "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "rm -Rf ./node_modules/app-angular2-fullcalendar/node_modules"
  },

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2018-04-19 11:50:15

我已经解决了这个问题。

错误:不能在角5中添加完整日历,它显示以下错误。

node_modules/ap-angular2-fullcalendar/src/calendar/calendar.d.ts(3,10):错误TS2305中的错误:模块“完整日历”没有导出的成员“选项”。node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(2525,10):error TS2717:后续属性声明必须具有相同的类型。属性'fullCalendar‘必须是'Calendar’类型,但是这里有'object‘类型。

问题:使用类型记录使用全日历调度程序有一种不同的方法。这和安古拉杰的情况不一样

解决方案:

步骤1:安装以下软件包

  • npm安装-保存jquery全日历全日历计划程序
  • npm安装
  • npm安装-保存-dev@type/jquery

步骤2:在view/html中添加以下代码

代码语言:javascript
复制
<div id='calendar'></div>

步骤3:In component.ts

代码语言:javascript
复制
import * as $ from 'jquery';
import 'fullcalendar';
import 'fullcalendar-scheduler';

@Component({
  moduleId: module.id,
  templateUrl: 'calendar.view.html'
})
export class CalendarComponent implements OnInit {
  containerEl: JQuery = $('#calendar');;

ngOnInit() {

  calendarOptions: Object = {
    defaultView: 'agendaDay',
    editable: true,
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    resources: [
      { id: 'a', title: 'Resource 1' },
      { id: 'b', title: 'Resource 2', eventColor: 'green' },
      { id: 'c', title: 'Resource 3', eventColor: 'orange' },
      { id: 'd', title: 'Resource 4', eventColor: 'red' }
    ],
    events: [
      { id: '1', resourceId: 'a', start: '2018-04-18T09:00:00', end: '2018-04-18T10:00:00', title: 'event 1' },
      { id: '2', resourceId: 'b', start: '2018-04-18T07:30:00', end: '2018-04-18T08:30:00', title: 'event 2' },
      { id: '3', resourceId: 'c', start: '2018-04-18T07:30:00', end: '2018-04-18T08:30:00', title: 'event 3' },
      { id: '4', resourceId: 'd', start: '2018-04-18T10:10:00', end: '2018-04-18T10:40:00', title: 'event 4' },
      { id: '5', resourceId: 'a', start: '2018-04-18T10:10:00', end: '2018-04-18T10:40:00', title: 'event 5' }
    ]                                                                         
  };
}

最重要的

  1. 不需要在app.module.ts中添加任何模块引用 从“ap-angular2-满日历”导入{ CalendarModule };@NgModule({ imports:[ CalendarModule,
  2. 不需要在component.ts中添加任何组件引用 从“ap-angular2-满日历”导入{ CalendarComponent };
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49491277

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档