模板:Codepen:修订间差异
来自康健生活
无编辑摘要 |
无编辑摘要 |
||
| 第11行: | 第11行: | ||
{{#tag:html|{{#tag:script|function {{{id|}}}(_){ | {{#tag:html|{{#tag:script|function {{{id|}}}(_){ | ||
const target = _.contentDocument <nowiki>||</nowiki> _.contentWindow.document; | const target = _.contentDocument <nowiki>||</nowiki> _.contentWindow.document; | ||
target.body.innerHTML = `{{#if:{{{style|}}}|{{#tag:style|{{{style|}}}|type=text/css}}|}}{{#if:{{{html|}}}|{{{html|}}}|}}` | target.body.innerHTML = `{{#if:{{{style|}}}|{{#tag:style|{{{style|}}}|type=text/css}}|}}{{#if:{{{html|}}}|{{{html|}}}|}}`; | ||
if ({{{script|}}}) { | if (!!{{{script|}}}) { | ||
const ele = document.createElement('script'); | const ele = document.createElement('script'); | ||
ele.type = 'text/javascript'; | ele.type = 'text/javascript'; | ||
2025年4月30日 (三) 10:47的版本
这个文档嵌入自模板:Codepen/doc
。
Usage
设置高度大于100,小于500
{{codepen
|id=uuid
|height=400
|html=<div></div>
|style=div {
display: block;
}
|script=var a=1;
}}