The pagination in the page uses fixed positioning to the bottom of the page, and the width of the paging container is set

Since the paging container is set with fixed positioning, fixed positioning is relative to windows positioning, so if the width of the fixed positioning container is set to 100%, it will be the width of windows, which is very unfriendly.
I want to set the width of the page to the specified width, but the width is not fixed

mounted() {
    
    
  this.setPaginationWidth()
  window.addEventListener('resize', this.setPaginationWidth)
  // 以下 this.$once() 代码其实也没有必要写
  this.$once('hook:beforeDestroy', () => {
    
    
  	window.removeEventListener('resize', this.setPaginationWidth)
  })
},
methods() {
    
    
  setPaginationWidth() {
    
    
    const rightDom = document.querySelector('.risk-detail-content-table') // 想要设置的分页的宽度的容器的dom
    const paginationDom = document.querySelector('.el-pagination') // 分页dom
    paginationDom.style.width = rightDom.offsetWidth + 'px'
  },
}

page display

insert image description here

Guess you like

Origin blog.csdn.net/m0_53562074/article/details/131123609