加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

属性’FroalaEditor’在’JQueryStatic’类型上不存在 – Angula

发布时间:2020-12-17 17:10:47 所属栏目:安全 来源:网络整理
导读:我使用的是使用’ JQuery‘的Angular 4’ FroalaEditor‘. 我成功地实现了它. 现在我需要在该插件中添加自定义按钮. 我在solution之后找到了 import { Component,OnInit,ViewEncapsulation } from '@angular/core';import * as $from 'jquery';@Component({
我使用的是使用’ JQuery‘的Angular 4’ FroalaEditor‘.

我成功地实现了它.
现在我需要在该插件中添加自定义按钮.

我在solution之后找到了

import { Component,OnInit,ViewEncapsulation } from '@angular/core';
import * as $from 'jquery';

@Component({
  selector: 'app-froala-editor',templateUrl: './froala-editor.component.html',styleUrls: ['./froala-editor.component.scss'],encapsulation: ViewEncapsulation.None
})
export class FroalaEditorComponent implements OnInit {
  options;
  constructor() { }

  ngOnInit(){
    $.FroalaEditor.DefineIcon('alert',{NAME: 'info'});
    $.FroalaEditor.RegisterCommand('alert',{
      title: 'Hello',focus: false,undo: false,refreshAfterCallback: false,callback: function () {
        alert('Hello!');
      }
    });

    this.options={
      toolbarButtons: ['bold','italic','underline','paragraphFormat','alert','|','insertLink','insertImage','specialCharacters','color','align','formatOL','formatUL','undo','redo','clearFormatting','print'],}
  }

}

但我有以下错误.

Property ‘FroalaEditor’ does not exist on type ‘JQueryStatic’.

我发现这是solution,但我不确定如何实现它.

有人遇到过这个问题吗?

解决方法

对我有用的解决方案是添加declare var $:any;而不是从’jquery’导入*作为$; 在使用编辑器的组件中导入之后.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读