Bản khảo sát nghiên cứu: Cho chúng tôi biết trải nghiệm của bạn khi sử dụng Blockly
Bắt đầu khảo sát
chặn > phần mềm > dom > createSvgElement
Hàm utils.dom.createSvgElement()
Phương thức trợ giúp để tạo các phần tử SVG.
Chữ ký:
export declare function createSvgElement<T extends SVGElement>(name: string | Svg<T>, attrs: {
[key: string]: string | number;
}, opt_parent?: Element | null): T;
Tham số
Thông số |
Loại |
Mô tả |
tên |
chuỗi | Svg<T> |
Tên thẻ của phần tử. |
attrs |
{ [key: string]: string | số; } |
Từ điển về tên và giá trị thuộc tính. |
opt_parent |
Phần tử | rỗng |
(Không bắt buộc) Phần tử mẹ (không bắt buộc) cần thêm phần tử. |
Trường hợp trả lại hàng:
T
nếu tên là một chuỗi hoặc một loại cụ thể hơn nếu đó là một thành phần của Svg.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-08-22 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-08-22 UTC."],[[["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"]]