研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
blockly >blockRendering >PathObject >PathObjectsetClass_
blockRendering.PathObject.setClass_() 方法
在路径对象的根 SVG 元素中添加或移除指定 CSS 类。
Signature:
protected setClass_(className: string, add: boolean): void;
参数
参数 |
类型 |
说明 |
className |
字符串 |
要添加或移除的课程的名称 |
add |
布尔值 |
如果应添加该类,则为 true。如果应将其移除,则为 false。 |
返回:
void
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["The `blockRendering.PathObject.setClass_()` method allows you to dynamically add or remove CSS classes on a path object's root SVG element."],["This method accepts two parameters: `className` (string) specifying the class name and `add` (boolean) indicating whether to add or remove the class."],["Utilizing this method enables you to control the styling and appearance of path objects within Blockly's block rendering system."]]],["The `setClass_()` method of the `PathObject` in the `blockRendering` namespace adds or removes a CSS class on the root SVG element. It takes two parameters: `className` (the class name) and `add` (a boolean indicating whether to add or remove the class). If `add` is true, the class is added; if false, it's removed. This method returns void.\n"]]