layer.html < string>
Insert HTML content into this layer. The html can be anything, from text, to input and form elements to canvas or SVG content.
If you need to target any of the created elements, remember that they are only available after Framer rendered them. To reliably get a reference to a DOM element, use layer.querySelector or layer.querySelectorAll.
If the content that gets inserted needs user interaction, it's best to set layer.ignoreEvents to false. To retain the layer structure, the content is placed within an element that gets created when you set HTML for the first time.
译:在此层中插入HTML内容。 html可以是任何东西,从文本、输入和表单元素画布和SVG内容。
如果您需要将任何创建的元素,请记住,在framer使他们后,他们才可用。要可靠地获得对DOM元素的引用,使用layer.querySelector或layer.querySelectorAll。
如果插入的内容需要用户交互,最好设置layer.ignoreEvents为false。 保留的层次结构、内容被放置在第一时间获取设置时创建HTML的元素。
layerA = new Layer
# Add simple text content
layerA.html = "Hello"
# Add inline styled text content
layerA.html = "I'm Koen"
# Add an input field
layerA.html = ""
# Add a div with a canvas element and get a reference
layerA.html = ""
canvasElement = layerA.querySelectorAll("#canvas")