角度4中的Jssor滑块

时间:2018-10-16 07:07:19

标签: angular jssor

我试图在我的angular 4项目中使用jssor滑块,我已经安装了jssor,但是当我尝试在app.component.html中使用时,出现错误。

ERROR in src/app/app.component.ts(17,30): error TS2552: Cannot find name '$JssorSlider$'. Did you mean 'jssor_1_slider'?

我的代码是

import { Component, OnInit, AfterViewInit } from '@angular/core';
   import * as $ from 'jquery';
   import * as $$ from 'jssor-slider';
   declare var jssor_1_slider_init: any;

  @Component({
     selector: 'app-root',
     templateUrl: './app.component.html',
     styleUrls: ['./app.component.css']
     })
    export class AppComponent implements OnInit, AfterViewInit {
      title = 'client';
      constructor() { }
      ngOnInit() {
        var options = { $AutoPlay: 1 };
        var jssor_1_slider = new $JssorSlider$("jssor_1", options);
      }
      ngAfterViewInit() {
        jssor_1_slider_init();
      }
    }

0 个答案:

没有答案