Skip to content

Commit

Permalink
Fix: 修复空值判断错误、修复 v-sticky-scroller 参数和文档描述不一致
Browse files Browse the repository at this point in the history
release 1.0.1
  • Loading branch information
Lruihao committed Sep 25, 2023
1 parent 97ab503 commit ea48ced
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cell-x/el-table-sticky",
"version": "1.0.0",
"version": "1.0.1",
"description": "A set of directives for element-ui el-table to make table header, footer and horizontal scrollbar sticky.",
"keywords": [
"vue",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class Scroller {
// create scroller
const scroller = document.createElement('div')
scroller.classList.add('el-table-horizontal-scrollbar')
scroller.style.bottom = value?.bottom ? convertToPx(value.bottom) : this.offsetBottom
scroller.style.bottom = value?.offsetBottom !== void 0 ? convertToPx(value.offsetBottom) : this.offsetBottom
// set scroller content width to .el-table__body width
const scrollContent = document.createElement('div')
scrollContent.style.width = `${tableBodyWrapperEl.querySelector('.el-table__body').offsetWidth}px`
Expand Down
4 changes: 2 additions & 2 deletions src/utils/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class Sticky {
}

const tableStickyWrapper = el.querySelector(`${selector}-wrapper`)
tableStickyWrapper.style[styleProperty] = value?.[offsetProperty]
tableStickyWrapper.style[styleProperty] = value?.[offsetProperty] !== void 0
? convertToPx(value[offsetProperty])
: this[offsetProperty]

Expand All @@ -112,7 +112,7 @@ export default class Sticky {
*/
async #initScroller(el, binding, vnode) {
const { value } = binding
const scrollerOffsetBottom = value?.offsetBottom ? convertToPx(value.offsetBottom) : this.offsetBottom
const scrollerOffsetBottom = value?.offsetBottom !== void 0 ? convertToPx(value.offsetBottom) : this.offsetBottom
if (this.#target === 'StickyFooter' && el.scroller) {
// wait for el-table render
await vnode.componentInstance.$nextTick()
Expand Down

0 comments on commit ea48ced

Please sign in to comment.