Skip to content

Commit

Permalink
fix(Demo): 已经有一个展开操作区固定在下方的情况下,再展开一个会出现重叠的现象
Browse files Browse the repository at this point in the history
fix #10
  • Loading branch information
xinlei3166 committed Oct 21, 2021
1 parent 38a5ec0 commit dd9f061
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions components/Demo.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<template>
<div
ref="demoBlock"
:class="[
'demo-block',
blockClass,
customClass ? customClass : '',
{ hover },
{ 'is-fixed': fixedControl }
]"
:class="['demo-block', blockClass, customClass ? customClass : '', { hover }]"
@mouseenter="hover = true"
@mouseleave="hover = false"
>
Expand Down Expand Up @@ -138,9 +132,6 @@ export default {
control.value.style.left = fixedControl.value ? `${left}px` : '0'
const dv = fixedControl.value ? 1 : 2
control.value.style.width = `${demoBlock.value.offsetWidth - dv}px`
if (fixedControl.value && !control.value.classList.contains('.is-fixed')) {
control.value.classList.add('is-fixed')
}
}
const scrollHandler = throttle(_scrollHandler, 200)
const removeScrollHandler = () => {
Expand Down Expand Up @@ -168,17 +159,6 @@ export default {
return
}
setTimeout(() => {
const controls = [...document.querySelectorAll('.demo-block')].filter(x =>
x.classList.contains('is-fixed')
)
for (const c of controls) {
if (c.offsetTop > window.innerHeight - 44) {
const control = c.querySelector('.demo-block-control')
control.classList.remove('is-fixed')
control.style.left = '0'
c.classList.remove('is-fixed')
}
}
window.addEventListener('scroll', scrollHandler)
window.addEventListener('resize', scrollHandler)
_scrollHandler()
Expand Down Expand Up @@ -270,7 +250,7 @@ export default {
}
.demo-block-control.is-fixed {
position: fixed;
position: sticky;
bottom: 0;
/* width: calc(100% - 320px - 48px - 200px - 1px); */
border-right: solid 1px #eaeefb;
Expand Down

0 comments on commit dd9f061

Please sign in to comment.