【问题标题】:Property 'printThis' does not exist on type 'JQuery<HTMLElement>'类型“JQuery<HTMLElement>”上不存在属性“printThis”
【发布时间】:2020-01-17 06:01:35
【问题描述】:

我想使用 jQuery 的属性 printThis() 以角度打印我的视图
但它给了我这个错误

类型“JQuery”上不存在属性“printThis”。

【问题讨论】:

标签: javascript jquery angular typescript


【解决方案1】:

对于类,使用下面的代码,

$(".demo").printThis();

对于Id,使用下面的代码,

$('#demo-one, #demo-two, #demo-three').printThis({
  importCSS: false, // option
  header: "<h1>Look at all of my Demo's!</h1>" //option
});

更多信息。访问this document

【讨论】:

  • 我用的是第一课。现在它消除了错误,但又带来了另一个错误。当我现在单击按钮时,它说 ERROR TypeError: $(...).printThis is not a function
  • 使用选项。愿它解决问题。或者提供您的代码,以便我们更容易理解问题的实际所在。 @user10762713
  • print() { $(".modal1").printThis(); } 这是我的方法
  • 如果您对它感到满意,请使用Id。 $("#anyId").click(function() { $("#modalId").printThis({ debug: true }); });你可以这样做。有关它的更多信息。访问此链接:jsfiddle.net/jasonday/Tx4Uv/12
  • @PushprajsinhChudasama -sir 我得到了 $(...).print 这不是一个函数你能告诉我如何解决它
猜你喜欢
  • 1970-01-01
  • 2018-03-08
  • 1970-01-01
  • 1970-01-01
  • 2018-06-21
  • 2020-02-16
  • 2020-04-08
  • 1970-01-01
  • 2022-01-13
相关资源
最近更新 更多