温温酱
既然你只说渲染,你就可以。你可以这样做:function render(){ var inp = document.getElementById("box"); var data = `
${inp.value}
cant touch this
`; var blob = new Blob( [data], {type:'image/svg+xml'} ); var url=URL.createObjectURL(blob); inp.style.backgroundImage="url("+URL.createObjectURL(blob)+")"; } οnlοad=function(){ render(); ro = new ResizeObserver(render); ro.observe(document.getElementById("box")); }#box{ color:transparent; caret-color: black; font-style: normal;/*must be same as in the svg for caret to align*/ font-variant: normal; font-size:13.3px; padding:2px; font-family:monospace;}you can edit me!这使得textarea将呈现html!除了调整大小时闪烁之外,无法直接使用类并必须确保svg具有与textarea为了使插入符号对齐正确,这是有效的!