|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
- <div ref="placeholderNode" :style="{ ...placeholderNodeStyle }">
|
|
|
- <div ref="fixedNode" :style="{ ...fixedNodeStyle }">
|
|
|
+ <div ref='placeholderNode' :style='{ ...placeholderNodeStyle }'>
|
|
|
+ <div ref='fixedNode' :style='{ ...fixedNodeStyle }'>
|
|
|
<slot />
|
|
|
</div>
|
|
|
</div>
|
|
@@ -46,10 +46,23 @@ export default {
|
|
|
type: String,
|
|
|
required: false,
|
|
|
default: () => null
|
|
|
+ },
|
|
|
+ /* 用户自定义函数*/
|
|
|
+ userFun: {
|
|
|
+ type: Function,
|
|
|
+ required: false,
|
|
|
+ default: () => {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 定义节流函数执行间隔时间 */
|
|
|
+ listenTime: {
|
|
|
+ type: Number,
|
|
|
+ required: false,
|
|
|
+ default: () => 300
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- this.lazyUpdatePosition = _.throttle(this.lazyUpdatePosition, 300)
|
|
|
+ this.lazyUpdatePosition = _.throttle(this.lazyUpdatePosition, this.listenTime)
|
|
|
return {
|
|
|
placeholderNodeStyle: '',
|
|
|
fixedNodeStyle: '',
|
|
@@ -81,6 +94,7 @@ export default {
|
|
|
eventName,
|
|
|
() => {
|
|
|
this.lazyUpdatePosition()
|
|
|
+ this.userFun()
|
|
|
}
|
|
|
)
|
|
|
})
|
|
@@ -125,6 +139,7 @@ export default {
|
|
|
width: placeholderReact.offsetWidth + 'px',
|
|
|
height: placeholderReact.offsetHeight + 'px'
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
unInit() {
|
|
|
const { entity } = this
|
|
@@ -145,4 +160,4 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang="less"></style>
|
|
|
+<style scoped lang='less'></style>
|