el-image 的关闭事件


// 预览照片
async handlePreviewImg(item) {
  this.viewData.power = item.power;
  this.viewData.pictureId = item.id;
  this.viewData.departmentName = sessionStorage.getItem('departmentName');
  this.viewData.userName = sessionStorage.getItem('loginName');
  this.viewData.userId = sessionStorage.getItem('userId');
  let res = await ViewApi.saveViewDetail(this.viewData);
  if(res && res.code == '10000' && res.resultFlag) {
    // 图片浏览成功
  }
  this.$nextTick(() => {
    let domImageView = document.querySelector(".el-image-viewer__mask"); // 获取遮罩层dom
    let closeEle = document.querySelector(".el-image-viewer__close"); // 获取遮罩层关闭按钮dom
    if (!domImageView || !closeEle) {
      return;
    }
    domImageView.addEventListener("click", () => {
      console.log('点击了遮罩层');
      // 页面刷新
      this.handleImagePage(this.activeObj.layers, this.activeObj.id);
    });
    closeEle.addEventListener("click", () => {
      console.log('点击了关闭按钮');
      // 页面刷新
      this.handleImagePage(this.activeObj.layers, this.activeObj.id);
    });
  });
}

你可能感兴趣的:(vue.js,image,element,vue.js,javascript,ecmascript,elementui,el-image)