jquery给合计行的金额列添加点击事件

 const footerWrapper = this.$refs.summaryTable.$el.querySelector('.el-table__footer-wrapper');
      if (!footerWrapper) {
        console.error('未找到合计行容器');
        return;
      }
const selector = `tbody tr td:nth-child(${i+1})`;
        const targetCell = footerWrapper.querySelector(selector);
        // const targetCell = footerWrapper.querySelector('tbody td:nth-child(2)');
        if (!targetCell) {
          console.error('未找到目标列');
          return;
        }

      if (item.primaryKey && item.type==='link' ) {
          // 绑定点击事件
          targetCell.addEventListener('click', (e) => {
            console.log('点击了',item.label);

            let params = {
              operateArrange:item.primaryKey
            }
            let allparams = {...this.jumpObj.query, ...params}
            let allparstr = encodeURIComponent(JSON.stringify(allparams));
            this.$router.push({
              path: this.jumpObj.path,
              query: {params: allparstr}
            })
          });
          targetCell.style.pointerEvents = 'auto';
          targetCell.style.color = '#FF6A6C'; // 直接修改颜色
          targetCell.style.cursor = 'pointer';
        }else {
          // targetCell.removeEventListener('click', (e) => {})
          targetCell.style.pointerEvents = 'none';
          targetCell.style.color = ''; // 直接修改颜色
          targetCell.style.cursor = '';
        }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容