vue 自适应页面高度

<template>
  <div :style="{height: this.winHeight + 'px'}">
	<div :style="{height: this.winHeight * 0.3 + 'px'}">div>
	<div :style="{height: this.winHeight * 0.3 + 'px'}">div>
	<div>底部的 div 会自适应高度div>
  div>
template>

<script>
export default {
  data () {
    return {
      winHeight: 0,
    }
  }
  created() {
	this.getHeight()
  },
  methods: {
	getHeight () {
      const winHeight = window.innerHeight
      // this.winHeight = winHeight - tabs 高度 这段可选
      console.log('winHeight', this.winHeight)
    },
  }
};
script>

你可能感兴趣的:(前端,vue.js,javascript,前端)