fix: fix remove unnecessary variables
This commit is contained in:
parent
179ca064ba
commit
ca01cbfd98
|
@ -19,7 +19,6 @@ const props = defineProps({
|
||||||
default: 'top'
|
default: 'top'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const active = ref(false)
|
|
||||||
const width = ref('auto' as string)
|
const width = ref('auto' as string)
|
||||||
const height = ref('auto' as string)
|
const height = ref('auto' as string)
|
||||||
const isSticky = ref(false)
|
const isSticky = ref(false)
|
||||||
|
@ -108,18 +107,16 @@ const handleReize = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const sticky = () => {
|
const sticky = () => {
|
||||||
if (active.value) {
|
if (isSticky.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
active.value = true
|
|
||||||
isSticky.value = true
|
isSticky.value = true
|
||||||
}
|
}
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
if (!active.value) {
|
if (!isSticky.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
width.value = 'auto'
|
width.value = 'auto'
|
||||||
active.value = false
|
|
||||||
isSticky.value = false
|
isSticky.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -131,7 +128,7 @@ const reset = () => {
|
||||||
top: position === 'top' ? offset + 'px' : '',
|
top: position === 'top' ? offset + 'px' : '',
|
||||||
bottom: position !== 'top' ? offset + 'px' : '',
|
bottom: position !== 'top' ? offset + 'px' : '',
|
||||||
zIndex: zIndex,
|
zIndex: zIndex,
|
||||||
position: active ? 'fixed' : 'static',
|
position: isSticky ? 'fixed' : 'static',
|
||||||
width: width,
|
width: width,
|
||||||
height: height
|
height: height
|
||||||
}"
|
}"
|
||||||
|
|
Loading…
Reference in New Issue