Bootstrap

VUE3+防抖 根据浏览器自动获取高度

<script setup lang="ts">
import { ref, reactive, onMounted} from 'vue';
import _ from 'lodash';

//基础
const windowHeight = ref(0);

//获取浏览器高度
const GetHeigth = () => {
    windowHeight.value = document.documentElement.clientHeight;
	window.addEventListener(
		'resize',
		_.debounce( ()=> {
			windowHeight.value = document.documentElement.clientHeight;
		}, 200),
		false
	);
};

onMounted(() => {
	GetHeigth();
});
</script>

根据浏览器自动获取高度 直接上代码

1. 先安装 npm install lodash

;