angularJs 7 集成 jQuery js库

1.首先使用npm命令安装jQuery

npm install jQuery

2.然后在index.html 引入jquery文件

<!-- 可以使用本地文件 -->
  <script type="text/javascript" src="assets/js/jquery.min.js"></script>

3.在要用到的components组件中使用:

import { Component, OnInit, Input } from '@angular/core';
import { AlertController } from '@ionic/angular';
import { ModalController } from "@ionic/angular";
import { ActionSheetService } from "ng-zorro-antd-mobile";
declare let $: any;
@Component({
  selector: 'app-test-name',
  templateUrl: './test-name.component.html',
  styleUrls: ['./test-name.component.scss'],
})
export class testNameOptComponent implements OnInit {

  constructor(
    private alert: AlertController,
    private eventService: EventService,
    public modalController: ModalController
  ) { }
  @Input() tagData: any;
  isshowhistory = false;   // 判断展示还是隐藏
  sessionId: string;
  receiveList: any;
  isDataShow = false;
  ifget: any;
  foldimg: any;
  pageSize: 0;
  ngOnInit() {
  }

  showclick() {

    this.isshowhistory = !this.isshowhistory;
    // const h = $(window).scrollTop();
    if (this.isshowhistory === true) {
      this.foldimg = "../../../assets/img/foldup.png";
      // $('#id-presales-history-panel').fadeIn();
      // $('#id-presales-history-panel').animate({ height: "auto" });
      // $("#id-presales-history-panel").slideDown();
      $("#id-presales-history-panel").slideToggle("slow");

      // $('html,body').animate({ "scrollTop": h + 800 }, 800);
      // localStorage.setItem('nav1ScrollToBottomTag', '50');
      // this.eventService.eventEmit.emit('nav1ScrollToBottom', '1');
    } else {
      // $('#id-presales-history-panel').fadeOut();
      // $("#id-presales-history-panel").slideUp();
      $("#id-presales-history-panel").slideToggle("slow");
      // $('html,body').animate({ "scrollTop": h + 800 }, 800);
      // localStorage.setItem('nav1ScrollToBottomTag', '50');
      // this.eventService.eventEmit.emit('nav1ScrollToBottom', '1');
      // this.foldimg = "../../../assets/img/folddown.png";
    }
    console.log(this.isshowhistory);
  }
 
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值