首页 > 其他分享 >vue页面表格组件高度控制

vue页面表格组件高度控制

时间:2024-04-17 12:13:11浏览次数:20  
标签:el vue console log refs window 组件 self 页面

//浏览器窗口内部高度
console.log("window.innerHeight",window.innerHeight); console.log("document.clientHeight",document.documentElement.clientHeight); console.log("body.clientHeight",document.body.clientHeight);
//获取vue组件元素的高度 console.log('queryPanelHeight',self.$refs.queryPanel.$el['offsetHeight']);
//获取表格在浏览器内的位置坐标 console.log('tableRect',self.$refs.tableGrid.$el.getBoundingClientRect());

应用代码如下

mounted () {
            this.tableHeightChange();
        }
tableHeightChange:function (){
                //this.$refs.queryConditionRef.$el.getBoundingClientRect().top:表格距离浏览器的高度
                this.$nextTick(function () {
                    this.outPatientsTableHeight = (window.innerHeight - this.$refs.tableGrid.$el.getBoundingClientRect().top);
                    // 监听窗口大小变化
                    let self = this;
                    window.onresize = function () {
                      self.tableHeight = (window.innerHeight - self.$refs.tableGrid.$el.getBoundingClientRect().top) ;
                    };
                });
            }

 

标签:el,vue,console,log,refs,window,组件,self,页面
From: https://www.cnblogs.com/sdlz/p/18140271

相关文章

  • element的表格页面宽度变化问题 (防抖函数)
      //表格问题(防抖函数) constdebounce=(fn,delay)=>{ lettimer=null; returnfunction(){ letcontext=this; letargs=arguments; clearTimeout(timer); timer=setTimeout(function(){ fn.apply(context,args); },delay); } } const_R......
  • vue代理问题设置
    proxy:{'/api':{target:"http://192.168.10.253:8082",//跨域地址changeOrigin:true,//支持跨域rewrite:(path)=>path.replace(/^\/api/,"")//重写路径,替换/api}} c......
  • vue3 + vant4 checkbox多选弹框
    实现效果代码如下多选组件DictSelect.vue<template><van-popup:show="showPicker"position="bottom":style="{height:'34vh'}"><divclass="con"><divclass="confirmBtns"&......
  • vue dayjs 安装指定版本
    在Vue项目中安装指定版本的Day.js库,你可以使用npm或者yarn。以下是安装指定版本Day.js的步骤:打开终端(命令行)。转到你的Vue项目目录。执行以下命令,其中x.x.x替换为你想要安装的Day.js版本号。使用npm安装指定版本的Day.js:[email protected] 或者使用......
  • vue相关内容
    vue相关路径配置1.根目录下的vite.config.jsimport{fileURLToPath,URL}from'node:url'import{defineConfig}from'vite'importvuefrom'@vitejs/plugin-vue'importAutoImportfrom'unplugin-auto-import/vite'importComponen......
  • vue2 mixin 和 vue3 hook
    mixin1.逻辑函数的复用2vue组件中的选项式API(例如:data,computed,watch)或者组件的生命周期钩子(created、mounted、destroyed)使用方法mixins:[mixins],//注册mixin,这样mixin中所有的钩子函数等同于组件中钩子1mixin中的生命周期函数会和组件的生命周期函数一起合并执行。2......
  • flutter 尝试创建第一个页面(三)
    新建目录assets 存放图片在pubspec..yaml中添加flutter:#ThefollowinglineensuresthattheMaterialIconsfontis#includedwithyourapplication,sothatyoucanusetheiconsin#thematerialIconsclass.uses-material-design:trueasset......
  • 小程序跨端,vue移植
    技术选型由于bun1.1.3windows版还有很多不兼容的小bug,先用pnpmtauri+taro+nutUI:https://github.com/AClon314/tauri-taro-template如何评价京东的Taro项目?-知乎(等tarov4正式版再做,beta的模板现在空白无法启动)tauri+vuetify:https://github.com/AClon314/tauri-vuet......
  • 前端学习-vue视频学习016-vue3新组件
    尚硅谷视频教程Teleport:让部分元素脱离原来的位置,到to指定的位置去此处指定了弹窗到body标签内<template><h4>Model</h4><button@click="isShow=true">打开弹窗</button><Teleportto='body'><divclass="tanchuang&q......
  • 实现不登录无法进入主页面的功能
    service.interceptors.response.use(res=>{console.log('---响应拦截器---',res)//未设置状态码则默认成功状态constcode=res.data.code;//获取错误信息constmsg=res.data.msgconsole.log('---code---',code)if(r......