无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
<includeonly> | <includeonly> | ||
{{# | {{#ifeq: {{{start|}}}|1| | ||
<!-- | <!-- 仅当start=1时才显示容器,避免参数被识别为卡片 --> | ||
<div class="mc-player-container"> | <div class="mc-player-container"> | ||
|}} | |}} | ||
{{#if: {{{name|}}}| | |||
<!-- 只有name参数存在时才显示卡片 --> | |||
<templatestyles src="Template:首页/style.css" /> | <templatestyles src="Template:首页/style.css" /> | ||
<templatestyles src="Template:卡片/Cards.css" /> | <templatestyles src="Template:卡片/Cards.css" /> | ||
<templatestyles src="Template:MCPlayerInfo/style.css" /> | <templatestyles src="Template:MCPlayerInfo/style.css" /> | ||
<div class="home-card mc-player-card"> | <div class="home-card mc-player-card"> | ||
<div class="transport-card mc-player-avatar"> | <div class="transport-card mc-player-avatar"> | ||
第18行: | 第19行: | ||
<div class="mc-player-info"> | <div class="mc-player-info"> | ||
<h3 class="home-card__header">{{{name| | <h3 class="home-card__header">{{{name|}}}</h3> | ||
<div class="mc-player-chinese">{{{chinese|}}}</div> | <div class="mc-player-chinese">{{{chinese|}}}</div> | ||
<div class="mc-player-english">{{{english|}}}</div> | <div class="mc-player-english">{{{english|}}}</div> | ||
</div> | </div> | ||
</div> | </div> | ||
|}} | |||
{{# | {{#ifeq: {{{end|}}}|1| | ||
</div> | </div> | ||
|}} | |}} | ||
第30行: | 第32行: | ||
<noinclude> | <noinclude> | ||
== | == 玩家信息卡片模板(参数修复版)== | ||
修复start/end参数被识别为卡片的问题,只显示有name的卡片。 | |||
== | == 核心修复 == | ||
1. | 1. 使用 `{{#ifeq}}` 精确判断start=1和end=1,避免误识别 | ||
2. | 2. 添加 `{{#if: {{{name|}}}|}}` 条件,只有name存在时才显示卡片 | ||
3. | 3. 移除默认值"未设置名称",避免空卡片显示 | ||
== 使用方法 == | == 使用方法 == | ||
{{MCPlayerInfo|start=1}} | |||
{{MCPlayerInfo | |||
| name = Notch | |||
| chinese = 马库斯·阿列克谢·泊松 | |||
| image = Notch_Avatar.png | |||
}} | |||
{{MCPlayerInfo|start=1}} | |||
{{MCPlayerInfo | |||
| name = Notch | |||
| chinese = 马库斯·阿列克谢·泊松 | |||
| image = Notch_Avatar.png | |||
}} | |||
{{MCPlayerInfo|start=1}} | |||
{{MCPlayerInfo | |||
| name = Notch | |||
| chinese = 马库斯·阿列克谢·泊松 | |||
| image = Notch_Avatar.png | |||
}} | |||
{{MCPlayerInfo|start=1}} | {{MCPlayerInfo|start=1}} | ||
{{MCPlayerInfo | {{MCPlayerInfo |
2025年7月26日 (六) 00:23的版本
玩家信息卡片模板(参数修复版)
修复start/end参数被识别为卡片的问题,只显示有name的卡片。
核心修复
1. 使用 `{{#ifeq}}` 精确判断start=1和end=1,避免误识别 2. 添加 `` 条件,只有name存在时才显示卡片 3. 移除默认值"未设置名称",避免空卡片显示
使用方法
Notch
马库斯·阿列克谢·泊松
Notch
马库斯·阿列克谢·泊松