
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
vue-json-views
Advanced tools
开发背景:
项目开发过程中遇到展示json的场景,且json文件体积过大,小则几百kb,也尝试了已经开源的部分组件,但由于节点过多,渲染速度过慢,无法使用,已有项目技术选型为vue,无法再使用react相关技术,所以考虑自己开发一款。
开发过程中参考了react-json-view部分api,组件实现的功能比较基础,但满足基本业务场景,也提供了一些可选配置。
即使加载1M左右的json文时,结合deep深度限制,也能实现秒开的速度
组件压所过后体积只有15.7kb,开启gzip压缩后只有4.74kb,
git clone https://github.com/zhaoxuhui1122/vue-json-view.git
npm i
npm run dev
或 直接双击index.html
npm i -S vue-json-views // 注意是 views
import jsonView from 'vue-json-views'
或
直接将未编译的组件复制到项目内(推荐该方式,便于自定义修改)
<template>
<json-view :data="json"/>
</template>
<script>
import jsonView from '@/components/json-view';
export default {
components: {
jsonView
},
data() {
return {
json: { /* json data*/ }
}
}
}
</script>
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
json | 传入的json数据(必填) | Object | - |
closed | 是否折叠全部 | Boolean | false |
deep | 展开深度,越大渲染速度越慢,建议不超过5 | Number | 3 |
icon-style | 折叠按钮样式,可选值为square、circle、triangle | String | square |
icon-color | 两个折叠按钮的颜色 | Array | theme=vs-code时,['#c6c6c6', '#c6c6c6'],其他情况为['#747983', '#747983'] |
theme | 可选主题样式,可选值为one-dark、vs-code,不选时为默认的白色主题 | String | - |
font-size | 字体大小,单位px | Number | 14 |
line-height | 行高,单位px | Number | 24 |
注:行高和字体大小不建议选用过大值,因为icon大小、每行的padding-left等参数并不会随之发生改变
可根据自己项目的实际情况进行如下开发
FAQs
一个用于展示json的vue组件
The npm package vue-json-views receives a total of 1,266 weekly downloads. As such, vue-json-views popularity was classified as popular.
We found that vue-json-views demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.