blockly > utils > dom > createSvgElement
تابع ()utils.dom.createSvgElement
روش کمکی برای ایجاد عناصر SVG.
امضا:
export declare function createSvgElement<T extends SVGElement>(name: string | Svg<T>, attrs: {
[key: string]: string | number;
}, opt_parent?: Element | null): T;
پارامترها
پارامتر | تایپ کنید | توضیحات |
---|
نام | رشته | Svg <T> | نام تگ عنصر. |
attrs | { [کلید: رشته]: رشته | شماره؛ } | فرهنگ نامها و مقادیر ویژگیها. |
opt_parent | عنصر | تهی | (اختیاری) والد اختیاری که عنصر به آن اضافه شود. |
برمیگرداند:
تی
اگر نام یک رشته یا نوع خاص تری باشد اگر عضوی از Svg باشد.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-01-06 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-01-06 بهوقت ساعت هماهنگ جهانی."],[[["Creates SVG elements with specified attributes and optional parent element."],["Accepts element tag name, attribute dictionary, and optional parent element as parameters."],["Returns the created SVG element, with typing based on the provided tag name."],["Simplifies SVG element creation within Blockly projects."]]],["The `createSvgElement` function creates SVG elements. It accepts the element's tag name (`name`) as either a string or a member of the `Svg` type, along with a dictionary of attributes (`attrs`) as key-value pairs (string or number). An optional parent element (`opt_parent`) can be provided to which the created element will be appended. The function returns the created SVG element, with a specific type if given a `Svg` member.\n"]]