pub fn CodeRunner(props: CodeRunnerProps) -> impl IntoViewExpand description
代码运行器组件。
Props:
source:初始源码(首次挂载用于初始化编辑器;之后编辑器内容是唯一真源, 与它不同即为「已修改」,「还原」写回它)。language:语言标识(python / node 等)。overrides:可选资源限制覆盖(可传ResourceLimits、Option<ResourceLimits>或省略)。instance_id:实例在父级片段序列中的索引,用作 CodeMirror 容器 id 后缀。 必须是 SSR/hydration 确定性的值(如父组件遍历片段的索引)——容器 id 在 SSR 与 水合两端必须一致,create()才能在 hydration 后找到 SSR 渲染的容器元素。highlighted:服务端高亮好的代码 HTML,编辑器挂载前显示;缺省时显示纯文本源码 (可传String、Option<String>或省略)。example_output:图鉴播放作者保存的输出,不实际运行(可传RunnerExample、Option<RunnerExample>或省略)。
§Required Props
source:impl Into<String>language:impl Into<String>instance_id:usize
§Optional Props
overrides:impl Into<MaybeProp<ResourceLimits>>highlighted:impl Into<MaybeProp<String>>example_output:impl Into<MaybeProp<RunnerExample>>