Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.17 KB

File metadata and controls

29 lines (22 loc) · 1.17 KB

前后端全局变量及相关示例

注意:在 markdown 文件中为了描述方便,用<file path="...">...content...</file>包裹表示src路径下需要写的文件路径和内容。如果直接是 src 目录中的文件,则不需要包裹 file 标签或代码块标记。

服务端全局变量定义示例

$BackendVariable({ description: '服务端全局变量1' }) export let backendVariable1: String = '123';

前端全局变量定义示例

$FrontendVariable({ description: '前端全局变量', localStorage: true, }) export let frontendVariable2: String; - httpRequest, httpResponse, currentUser 为服务端只读全局变量,不可修改,只可使用 - `currentUser` 的字段含义、与 `nasl.auth.getCurrentUser()` / 前端 `nasl.auth.userInfo` 的端侧区分见 nasl-book/K011-nasl--current-user-and-nasl-auth.md - localStorage: 开启后,变量的读写均绑定到 localStorage 中对应的 item,复杂数据类型会自动进行序列化和反序列化。起到本地缓存的作用。