|
@@ -29,6 +29,7 @@ export default defineComponent({
|
|
|
data() {
|
|
|
return {
|
|
|
divStyle: {} as any,
|
|
|
+ heightV: 0,
|
|
|
sectionStyle: {
|
|
|
width: '100%',
|
|
|
height: 'auto',
|
|
@@ -51,9 +52,21 @@ export default defineComponent({
|
|
|
setTimeout(() => {
|
|
|
const { height } = useRect((this as any).$refs.div)
|
|
|
this.sectionStyle.height = `${height}px`
|
|
|
+ this.heightV = height
|
|
|
this.$emit('getHeight', height)
|
|
|
console.log(height, 'osticky height')
|
|
|
}, 200)
|
|
|
+
|
|
|
+ // 在次判断高度是否变化
|
|
|
+ setTimeout(() => {
|
|
|
+ const { height } = useRect((this as any).$refs.div)
|
|
|
+ if (height !== this.heightV) {
|
|
|
+ this.sectionStyle.height = `${height}px`
|
|
|
+ this.heightV = height
|
|
|
+ this.$emit('getHeight', height)
|
|
|
+ console.log(height, 'next osticky height')
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
})
|
|
|
},
|
|
|
watch: {
|