惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
P
Privacy & Cybersecurity Law Blog
The Hacker News
The Hacker News
博客园 - 司徒正美
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
I
Intezer
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
博客园 - 叶小钗
J
Java Code Geeks
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
A
Arctic Wolf
B
Blog RSS Feed
Recorded Future
Recorded Future
D
DataBreaches.Net
有赞技术团队
有赞技术团队
Project Zero
Project Zero
U
Unit 42
T
Tor Project blog
The GitHub Blog
The GitHub Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
CERT Recently Published Vulnerability Notes
博客园 - Franky
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Security Latest
Security Latest
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
H
Heimdal Security Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
S
Securelist

博客园 - 彭成刚

reloadenv 函数 `code $PROFILE` vscode在不关闭下刷新环境变量 volta 安装记录 node多版本控制 && @native-sdk OmniVoice 记录 我觉得音色还原还不错 voiceclone-env 记录 vscode pwsh 全选快捷键 ctrl+a (powershell) ai专属使用 aitree 命令 ai配合重要命令 powershell vscode code $PROFILE 备份,配合conda使用vscode $setHideObjProp 设置js json对象属性 隐藏变量 不可枚举,post的时候不带这个变量 GPT-SoVITS 环境搭建及应用 回车小问题 vscode markdown 开始几次回车不好使 markdown.extension.onEnterKey miniconda 使用记录 columns 内部watch columns, 又修改了columns内部 死循环bug 导致内存溢出 tables.vue 重点解决代码 let res = { ...item } json 格式化 (notepad++/插件/插件管理/JsonTools | JsonViewer)有快捷键,注意key要有双引号 + 176个插件介绍 Service workers 缓存导致 3000端口占用 解决方案 Unregister - FossFLOW iview table 单行显示文字 默认key 文字超出宽度 显示... 加tip cut-text2.vue configQueryListFunc.js 命令行合并图片成为pdf `magick *.jpg o.pdf` vue2 自动格式化 函数名和括号直接没有空格了 eslint爆红,解决方案,函数名+空格+() vscode 设置 flex gap 对老版本浏览器兼容 - "flex-gap-polyfill": "^1.0.4", 老版 对 vue2 iview 打包失败的解决方案 [软件推荐] 手机同步电脑 PandaControl 开发安卓app 截屏用的 Multi-Layer Perceptron.xlsx 讲明白ai底层本质 pdfjs-3.11.174-legacy-dist.zip 最后一个cdn版本,每次要升级pdfjs 都是这个坑,中间件不支持mjs,但是国产化那个老浏览器媲美ie6 做了一个卷子去底的程序 python-clear-paper [ai问答] js对象 某个属性找到父节点 __parent__ 一键注入函数 buildTreeRelations [精品] npm 内网离线安装包 从缓存本地安装, .tgz安装失败时候,用这个cache方案 三次贝塞尔曲线 一直想要一个 曲线箭头,先AI出个代码先存着。 http-server-o.bat 最方便启动当前目录的index.html [记录] 多文件上传BUG解决记录-选择文件后-修改本地文件名-点击上传失败 的解决过程 vscode 查看全局包函数源码 没安装插件 - 快速跳转第三方库的函数源码 - 在资源管理器视图中显示 自定义快捷键 Alt+Shift+Z vscode vue2项目 自定义 abc类型 自动提示 3种提示方式 分别是 abc this.abc window.abc vscode 提交 github 的 git提交 记得设置 proxy - 基础知识 阻止连点小函数 if(islock()) return vue 双向绑定 对象初始化 不替换指针 用 Object.assign(app.value.modalAddWan, $app.modalAddWan) lunacy 单机离线免费 ui设计工具 平替 figma sketch [工具推荐] 双击最大化 软件右边留出一些空白 MaxMax 软件推荐 [推荐] GLM-4.7 智谱 Agentic Coding AI开发 环境安装 vibe coding 鼠标有小圈圈在转,原因是安全中心在扫描你的程序,关闭扫描方案 右下角广告 查看pid 映射是哪个程序弹框 Process Explorer 我发现我就是太善良了,总愿意相信有免费的api(AI) 软件推荐:Beyond.Compare.v3.3.13.18981 文本对比软件 临时忽略 config.js git命令 node_modules 软连接 win11 mklink /D 两个项目共享一个库 需求:两个分支,两套代码同时修改 iview table 排序 columns 里面写 sortable: 'custom' 不要写 sortable: true 不然会进行二次内部排序序号等 字段。 vue2 重置 data方法 $data $options.data.call(this) vue中 先写 函数调用 再写 函数定义的 小技巧 function caller () {} copy-used-css 代码段 snippet,将指定节点的计算样式获取下拉 获取tailwind网页样式成原生样式 Syntax Error: TypeError: eslint.CLIEngine is not a constructor 解决方案 Comment Anchors [vscode插件推荐] 注释跳转 ANCHOR[id=锚点] LINK path/file.vue#锚点 写了一个undefind 的bug ['',null,undefined].includes(unName) 应该是 typeof unName === 'undefined' pad开发bug vscode 左侧栏 显示隐藏 ctrl+b 查看:切换主侧栏可见性 View: Toggle Primary Side Bar Visibility
vue2 hooks useInnerHeight.vue 解决Table高度实时更新
彭成刚 · 2025-08-26 · via 博客园 - 彭成刚

vue2 hooks useInnerHeight.vue 解决Table高度实时更新

背景

iview Table组件 有一个height的属性,为了实现浏览器改变,需要高度实时变化

useInnerHeight.vue

/src/hooks/useInnerHeight.vue

<template>
  <span style="display: hidden;"></span>
</template>

<script>
export default {
  components: {},
  props: {
    value: Number
  },
  data () {
    return {
      innerHeight: window.innerHeight,
    }
  },
  watch: {},
  computed: {
  },
  methods: {
    resizeHeight() {
      this.$emit('input', window.innerHeight)
    },
  },
  created () { },
  activated () { },
  mounted () { 
    window.addEventListener("resize", this.resizeHeight);
  },
  beforeDestroy () { 
    window.removeEventListener("resize", this.resizeHeight);
  }
}
</script>

<style lang="less" scoped>
</style>

app.vue

<template>
  <div id="app" style="width: 100%; height: 100%;">
    <useInnerHeight v-model="innerHeight"/>
  </div>
</template>

<script>
import useInnerHeight from '@/hooks/useInnerHeight'
export default {
  name: 'App',
  components: { useInnerHeight },
  data () {
    return {
      innerHeight: window.innerHeight,
    }
  },
  computed: {
  },
  created () {
    Vue.prototype.$app = this
  },
  methods: {
  },
  mounted () {
  },
  destroyed () {
  }
}
</script>
<style scoped lang="less">
</style>

业务页面.vue

<template>
   <div class="container-table mt10">
      <Table
        :height="tableHeight"
      >
    </Table>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data () {
    return {
    }
  },
  watch: {},
  computed: {
    tableHeight() {
      return this.$app.innerHeight - 180 - 40;
    },
  },
  methods: {
  },
  created () { },
  activated () { },
  mounted () {
   },
  beforeDestroy () { 
  }
}
</script>
<style lang="less" scoped>
</style>

使用的两种方法

  1. 全局使用,上面的用法就是全局使用,因为很多页面都会用到实时的innerHeight,所以就挂到了全局
  2. 局部使用,有的是业务代码,可以直接在业务页面使用。在页面创建一个变量,绑定到组件上。就不需要挂到全局使用了。