概述
blessed 提供全屏 TUI 组件与渲染的能力。本参考列出最常用的核心 API 与典型用法,帮助你快速上手并在生产环境中安全使用。
核心 API
blessed.screen:签名与典型用法见下方代码示例。blessed.box:签名与典型用法见下方代码示例。screen.key:签名与典型用法见下方代码示例。
代码示例
const blessed = require('blessed');
const screen = blessed.screen({ smartCSR: true, title: 'dashboard' });
使用注意
组件改动会被缓冲,必须调用 screen.render() 才会绘制。该包基本停止维护,新项目可评估活跃分支或 Ink。
验证方式
创建一个 box 并 append 到 screen,调用 render 后确认内容在终端可见。