React-JSONResult使用(JSON展示)
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json
免费下载资源
·
效果:
封装JSONResult
JSONResult/index.js:
import PropTypes from 'prop-types';
import styles from './index.less';
import JSONTree from 'react-json-tree';
import theme from './theme';
function TestResult({ result }) {
return (
<div className={styles.testResult}>
<div className={styles.inner}>
{result ? (
<JSONTree
data={result}
theme={theme}
shouldExpandNode={() => {
return true;
}}
/>
) : (
''
)}
</div>
</div>
);
}
TestResult.propTypes = {
result: PropTypes.object
};
export default TestResult;
JSONResult.less :
.testResult {
.inner {
height:500px;
overflow: scroll;
padding-left:10px;
}
}
JSONResult/ theme.js:
const theme = {
scheme: 'monokai',
author: 'wimer hazenberg (http://www.monokai.nl)',
base00: '#272822',
base01: '#383830',
base02: '#49483e',
base03: '#75715e',
base04: '#a59f85',
base05: '#f8f8f2',
base06: '#f5f4f1',
base07: '#f9f8f5',
base08: '#f92672',
base09: '#fd971f',
base0A: '#f4bf75',
base0B: '#a6e22e',
base0C: '#a1efe4',
base0D: '#66d9ef',
base0E: '#ae81ff',
base0F: '#cc6633'
};
export default theme;
使用:
import JSONResult from 'components/JSONResult';
<JSONResult result={testResult} />
GitHub 加速计划 / js / json
18
5
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:3 个月前 )
0f9e6ae0
Signed-off-by: Niels Lohmann <mail@nlohmann.me> 14 小时前
8a882f32
* Support any basic_json type in NLOHMANN_DEFINE_TYPE_* macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Test NLOHMANN_DEFINE_TYPE_* macros also support unordered_json
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Simplify test about NLOHMANN_DEFINE_TYPE_ with many arguments
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove extra scope in macros tests
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove unused test class in macros tests
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Update documentation about NLOHMANN_DEFINE_TYPE_* macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix NLOHMANN_JSON_SERIALIZE_ENUM documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Mark some variables const in macros tests, fixes clang-tidy
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Workaround clang 3.5 issue with const object initialization
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Update highlighted lines in NLOHMANN_DEFINE_TYPE_* macros examples
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix swapped macros in documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove extra backslashes at the end of macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Require basic_json type in NLOHMANN_DEFINE_TYPE_* generated functions
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix typos in macros documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
---------
Signed-off-by: kimci86 <kimci86@hotmail.fr> 14 小时前
更多推荐
已为社区贡献2条内容
所有评论(0)