模块:An Night:修订间差异
来自RIA | Wiki
更多操作
创建页面,内容为“local p = {} function p.render() return [[ <div class="my-toggle-text" onclick="this.classList.toggle('active')"> 点击切换颜色 </div> ]] end return p” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
local p = {} | local p = {} | ||
function p.render() | function p.render() | ||
-- 使用 mw.html 创建结构化 HTML,避免 MediaWiki 自动添加 <pre> | |||
local html = mw.html.create('div') | |||
:addClass('my-toggle-text') | |||
:attr('onclick', "this.classList.toggle('active')") | |||
:wikitext("点击切换颜色") -- 这里放你的文本 | |||
return tostring(html) | |||
end | end | ||
return p | return p | ||
2025年8月15日 (五) 18:13的最新版本
此模块的文档可以在模块:An Night/doc创建
local p = {}
function p.render()
-- 使用 mw.html 创建结构化 HTML,避免 MediaWiki 自动添加 <pre>
local html = mw.html.create('div')
:addClass('my-toggle-text')
:attr('onclick', "this.classList.toggle('active')")
:wikitext("点击切换颜色") -- 这里放你的文本
return tostring(html)
end
return p