Blame view

ant-design-vue-jeecg/src/components/layouts/PageView.vue 1.61 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
<template>
  <page-layout :desc="description" :title="getTitle" :link-list="linkList" :search="search" :tabs="tabs">
    <div slot="extra" class="extra-img">
      <img :src="extraImage"/>
    </div>
    <!-- keep-alive  -->
    <route-view ref="content"></route-view>
  </page-layout>
</template>

<script>
肖超群 authored
12
13
import PageLayout from '../page/PageLayout'
import RouteView from './RouteView'
肖超群 authored
14
肖超群 authored
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export default {
  name: "PageContent",
  components: {
    RouteView,
    PageLayout
  },
  data() {
    return {
      title: '',
      description: '',
      linkList: [],
      extraImage: '',
      search: false,
      tabs: {}
    }
  },
  mounted() {
    this.getPageHeaderInfo()
  },
  updated() {
    this.getPageHeaderInfo()
  },
  computed: {
肖超群 authored
38
肖超群 authored
39
40
41
    getTitle() {
      return this.$route.meta.title
    }
肖超群 authored
42
肖超群 authored
43
44
45
46
47
48
49
  },
  methods: {
    getPageHeaderInfo() {
      // eslint-disable-next-line
      this.title = this.$route.meta.title
      // 因为套用了一层 route-view 所以要取 ref 对象下的子节点的第一个对象
      const content = this.$refs.content && this.$refs.content.$children[0]
肖超群 authored
50
肖超群 authored
51
52
53
54
55
56
      if (content) {
        this.description = content.description
        this.linkList = content.linkList
        this.extraImage = content.extraImage
        this.search = content.search == true ? true : false
        this.tabs = content.tabs
肖超群 authored
57
58
59
      }
    }
  }
肖超群 authored
60
}
肖超群 authored
61
62
63
</script>

<style lang="less" scoped>
肖超群 authored
64
65
66
67
68
69
70
71
72
73
74
.extra-img {
  margin-top: -60px;
  text-align: center;
  width: 195px;

  img {
    width: 100%;
  }
}

.mobile {
肖超群 authored
75
  .extra-img {
肖超群 authored
76
    margin-top: 0;
肖超群 authored
77
    text-align: center;
肖超群 authored
78
    width: 96px;
肖超群 authored
79
80
81
82
83

    img {
      width: 100%;
    }
  }
肖超群 authored
84
}
肖超群 authored
85
</style>