<template>
  <div class="page">
    <z-header
      v-if="!noHeader"
      :noLeft="mainPage"
      :lText="backText"
      :background="background"
      @backClick="backClick">
      {{title}}
    </z-header>
    <z-content :style="contentStyle">
      <slot></slot>
    </z-content>
  </div>
</template>

<script>
import zHeader from './header.vue'
import zContent from './content.vue'

export default {
  components: {
    zHeader,
    zContent,
  },
  props: {
    title: String,
    mainPage: Boolean,
    backText: String,
    background: String,
    noHeader: Boolean,
  },
  computed: {
    contentStyle() {
      return this.noHeader ? "height: 100%;" : ''
    }
  },
  data() {
    return {

    }
  },
  methods: {
    backClick() {
      if(this.$router) this.$router.go(-1)
      else alert('无路由操作')
    }
  }
}
</script>

<style scoped lang="less">
.page {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: white;
}
</style>
