<template>
|
<default-header-page-layout ref="page" title="范例页面" >
|
<view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
|
<action-user-row />
|
<view class="with-action-user-row-page-content">
|
</view>
|
</view>
|
</default-header-page-layout>
|
</template>
|
|
<script>
|
import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
|
import ActionUserRow from '@/components/ActionUserRow.vue'
|
let initInterVal = null;
|
export default {
|
name:'demoPage',
|
components:{DefaultHeaderPageLayout,ActionUserRow},
|
data(){
|
return {
|
pageBodyHeight:0
|
}
|
},
|
methods:{
|
/* 页面初始化获取页面body高度的定时器 */
|
startInitInterval(callback){
|
initInterVal = setInterval(()=>{
|
if (this.pageBodyHeight) {
|
this.clearInitInterval()
|
callback && callback()
|
} else {
|
this.pageBodyHeight = this.$refs.page.getBodyHeight()
|
}
|
},200)
|
},
|
/* 清除定时器 */
|
clearInitInterval(){
|
try{
|
clearInterval(initInterVal)
|
initInterVal = null
|
}catch(e){
|
//TODO handle the exception
|
}
|
}
|
},
|
onReady(){
|
this.startInitInterval(()=>{
|
/* 页面初始化后需要执行的代码在这边调用 */
|
})
|
},
|
onUnload(){
|
this.clearInitInterval()
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
</style>
|