PageComponent.vue
2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
<view class="page-box" :style="pageStyle">
<view
class="nav-bar"
:style="{ 'z-index': backProp.zindex || 9 }"
>
<template v-if="backProp.show">
<view
class="back"
@click="backProp.click"
>
<uni-icons
:type="backProp.iconType || 'left'"
:size="backProp.size || 20"
:color="backProp.color || '#000'"
></uni-icons>
</view>
</template>
{{ title }}
</view>
<slot></slot>
<FloatLogPanel v-if="showFloatLog" />
</view>
</template>
<script type='text/ecmascript-6'>
import FloatLogPanel from '@/components/FloatLogPanel/FloatLogPanel.vue'
import FloatLogConfig from '@/utils/logger/FloatLogConfig.js'
export default {
components: { FloatLogPanel },
props: {
pageStyle: {
type: String,
default: ''
},
backProp: {
type: Object,
default: () => {
return {
show: true,
click: () => {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100
})
}
}
}
},
title: {
type: String,
default: ''
}
},
data() {
return {
showFloatLog: false
}
},
mounted() {
this._syncShowFloatLog()
this._unsubFloatLog = FloatLogConfig.subscribe(() => {
this._syncShowFloatLog()
})
},
beforeDestroy() {
this._unsubFloatLog && this._unsubFloatLog()
},
methods: {
_syncShowFloatLog() {
this.showFloatLog = FloatLogConfig.isLogBallVisible()
}
}
}
</script>
<style scoped lang='scss'>
.page-box {
position: relative;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%;
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
text-align: center;
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
line-height: toRpx(96);
.back {
position: absolute;
left: 0;
top: 0;
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
}
}
}
</style>