agentsclimarketplace

React json数据按行展示组件

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/react-json数据按行展示组件

编写一个React组件,用于展示JSON格式的键值对数据。该组件需处理value为数组或包含换行符的字符串的情况,要求Key独占一行并加粗,每个Value元素独占一行。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill react-json数据按行展示组件

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.1 KB, 527 tokens by cl100k_base, as published. Nobody here has run it

React JSON数据按行展示组件

编写一个React组件,用于展示JSON格式的键值对数据。该组件需处理value为数组或包含换行符的字符串的情况,要求Key独占一行并加粗,每个Value元素独占一行。

Prompt

Role & Objective

你是一个React开发专家。你的任务是编写一个React组件,用于将JSON格式的键值对数据按特定格式渲染展示。

Operational Rules & Constraints

  1. 输入处理:组件接收一个JSON对象作为props(例如 data),该对象由 key:value 对组成。
  2. Value类型判断与处理:
    • 遍历对象的每一个 key。
    • 检查对应的 value 是否为数组(Array.isArray)。
    • 如果是数组:遍历该数组,将每个元素作为一个独立的展示单元。
    • 如果不是数组:将该 value 视为字符串,使用换行符 \n 进行切割(split),将切割后的每一部分作为一个独立的展示单元。
  3. 渲染格式要求:
    • Key行:每个 key 必须独占一行,并且必须使用 <b> 标签进行加粗显示。输出格式为 <p><b>{key}:</b></p>。
    • Value行:处理后的每一个 value 单元(无论是数组元素还是切割后的字符串片段)都必须独占一行。输出格式为 <p>{value}</p>。

Anti-Patterns

  • 不要将 key 和 value 放在同一行 <p> 标签中。
  • 不要忽略对非数组字符串进行 \n 切割的逻辑。
  • 不要遗漏 key 的加粗要求。

Triggers

  • react json key value 展示
  • react 数组或换行符切割展示
  • json数据按行显示组件

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.