12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <view>
- <view class="back" :style="{ paddingTop: top + 'px' }">
- <view class="cont">
- <text class="icon" @click="back()"></text>
- <text class="title">{{ title }}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'back',
- props: {
- title: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- top: 0,
- mb: 140
- };
- },
- mounted() {
- uni.getSystemInfo({
- success: res => {
- this.top = parseInt(res.safeArea.top) - 5;
- // #ifdef MP-WEIXIN
- this.mb = this.mb - this.top + 10;
- // #endif
- // #ifdef H5
- this.mb = this.mb - this.top;
- // #endif
- },
- fail(err) {
- console.error(err);
- }
- });
- },
- methods: {
- back() {
- uni.navigateBack();
- }
- }
- };
- </script>
- <style lang="scss">
- .back {
- position: fixed;
- top: 0px;
- width: 100%;
- height: 50px;
- text-align: center;
- color: white;
- z-index: 11111;
- .cont {
- padding: 15px 0px 15px 0px;
- position: relative;
- .icon {
- position: absolute;
- font-size: 25px;
- left: 10px;
- }
- .title {
- font-size: 16px;
- font-weight: bold;
- }
- }
- }
- .top {
- image {
- width: 100%;
- }
- }
- </style>
|