<template>
|
<header-page-layout ref="page" :title="title" base-background-color="#f8f8ff" background-color="#f2f2f2" @headerclick="onHeaderClick">
|
<template v-slot:headerleft><u-icon name="arrow-left"></u-icon></template>
|
<template v-slot:headerright><u-icon name="list"></u-icon></template>
|
<slot></slot>
|
<template v-slot:footer v-if="$scopedSlots.footer"><slot name="footer"></slot></template>
|
|
<easy-picker :visible.sync="actionVisible" :list="actionList" @select="onActionClick"></easy-picker>
|
</header-page-layout>
|
</template>
|
|
<script>
|
import HeaderPageLayout from './HeaderPageLayout.vue'
|
import EasyPicker from './EasyPicker.vue'
|
import { downloadApk } from '@/static/js/utils/index.js'
|
export default {
|
name:'defaultHeaderPageCompontent',
|
emits:['back'],
|
components:{HeaderPageLayout,EasyPicker},
|
props:{
|
title:{
|
type:String,
|
default:'Title'
|
},
|
backCustom:{
|
type:Boolean,
|
default:false
|
}
|
},
|
data(){
|
return {
|
actionVisible:false,
|
actionList:['刷新','首页','退出']
|
}
|
},
|
methods:{
|
onHeaderClick(type){
|
if (type==='left'){
|
if (this.backCustom===true) {
|
this.$emit('back')
|
} else {
|
uni.navigateBack({
|
delta: 1
|
});
|
}
|
} else {
|
this.actionVisible = true
|
}
|
},
|
onActionClick(val){
|
if (val==='刷新'){
|
uni.navigateBack({
|
delta: 0
|
});
|
} else if (val==='首页') {
|
uni.redirectTo({url:this.$config.path.home})
|
} else if (val==='退出') {
|
uni.redirectTo({url:this.$config.path.login})
|
} else if (val==='新版下载') {
|
downloadApk(this.$config)
|
}
|
},
|
getBodyHeight(){
|
let res = null;
|
if (this.$refs.page) {
|
res = this.$refs.page.getBodyHeight()
|
}
|
return res;
|
}
|
},
|
created() {
|
if (process.env.NODE_ENV!=='development') {
|
this.actionList.push('新版下载')
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
|
</style>
|