fix(affix): change target.value to props.target in judgement (#1343)

This commit is contained in:
kooriookami 2021-01-24 05:29:05 -06:00 committed by GitHub
parent 59422d7fab
commit d58f480aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,7 @@ export default defineComponent({
state.clientHeight = document.documentElement.clientHeight
if (props.position === 'top') {
if (target.value) {
if (props.target) {
const difference = targetRect.bottom - props.offset - state.height
state.fixed = props.offset > rootRect.top && targetRect.bottom > 0
state.transform = difference < 0 ? difference : 0
@ -88,7 +88,7 @@ export default defineComponent({
state.fixed = props.offset > rootRect.top
}
} else {
if (target.value) {
if (props.target) {
const difference = state.clientHeight - targetRect.top - props.offset - state.height
state.fixed = state.clientHeight - props.offset < rootRect.bottom && state.clientHeight > targetRect.top
state.transform = difference < 0 ? -difference : 0