暂存
Former-commit-id: a691bed1d3831eff972236144a57b6b9cba32f1d [formerly a691bed1d3831eff972236144a57b6b9cba32f1d [formerly a691bed1d3831eff972236144a57b6b9cba32f1d [formerly a691bed1d3831eff972236144a57b6b9cba32f1d [formerly 5e41ab23bd0ceef291a36c9ef8fde5a7aa4278ad [formerly 841fabfa756d397bd6258cd648970c754e0dca3c]]]]] Former-commit-id: 13233ef25e853383f1cf1a1437faf079f5f333ff Former-commit-id: e90f61299f0acee023daa0021b301e6e26e35a67 Former-commit-id: 78275758a8c367652dbd950bdf54b98fdd9d4abf [formerly c8926288ba8a113e1066991d2a26326db69e1586] Former-commit-id: 645448b80ba2f67dc1d8a2cb18054c501508bc6f Former-commit-id: 869f9d8698c412fdedeb8e388942cd00c5f0c7bc Former-commit-id: 89a9c4e1d39c99220284f6516c6f5491cd54212d Former-commit-id: c68a320534e9b90ea4c6f12c5489bb2c86105973 Former-commit-id: 79576a305f61a7330298b452744bbc3c5b985c51
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div v-if="$slots.header" class="d2-container-full__header" ref="header">
|
||||
<slot name="header"/>
|
||||
</div>
|
||||
<div class="d2-container-full__body">
|
||||
<div class="d2-container-full__body" ref="body">
|
||||
<slot/>
|
||||
</div>
|
||||
<div v-if="$slots.footer" class="d2-container-full__footer" ref="footer">
|
||||
@@ -13,7 +13,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import scroll from './mixins/scroll.normal'
|
||||
export default {
|
||||
name: 'd2-container-full'
|
||||
name: 'd2-container-full',
|
||||
mixins: [
|
||||
scroll({
|
||||
ref: 'body'
|
||||
})
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// 提供滚动方面的功能
|
||||
// 非滚动优化模式通用
|
||||
|
||||
import { throttle } from 'lodash'
|
||||
|
||||
/**
|
||||
* 根据配置输出 mixin 设置
|
||||
* @param {String} ref 滚动容器 ref 名称
|
||||
*/
|
||||
export default function ({ ref }) {
|
||||
return {
|
||||
data () {
|
||||
return {
|
||||
throttledHandleScroll: throttle(() => {
|
||||
console.log(this.$refs[ref].scrollTop)
|
||||
}, 300)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.$refs[ref].addEventListener('scroll', this.throttledHandleScroll)
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.$refs[ref].removeEventListener('scroll', this.throttledHandleScroll)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user