# 隐藏详情中的投票

**URL:** https://meta.discourse.org/t/polls-within-hide-details/196150
**Category:** Support
**Tags:** hide-details
**Created:** [2021年七月6日 10:08 UTC](https://meta.discourse.org/t/polls-within-hide-details/196150 "2021-07-06T10:08:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kaidenh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kaidenh/32/220661_2.png) [@kaidenh](https://meta.discourse.org/u/kaidenh)
#### Post date: [2021年七月6日 10:08 UTC](https://meta.discourse.org/t/polls-within-hide-details/196150/1 "2021-07-06T10:08:07Z")

</div>

嘿！  
如果我创建一个投票，它会正常显示。

_Poll ([view on site](https://meta.discourse.org/t/polls-within-hide-details/196150/1))_

但如果我在 **详情** 中创建一个投票，它显示为杂乱文本。

> **隐藏详情**
>
> _Poll ([view on site](https://meta.discourse.org/t/polls-within-hide-details/196150/1))_

这是错误吗？

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2021年七月6日 11:23 UTC](https://meta.discourse.org/t/polls-within-hide-details/196150/2 "2021-07-06T11:23:15Z")

</div>

哦，我知道这个问题的答案。🙂

这是因为你需要将投票代码单独放在一行。你可以将 HTML 的隐藏详情标签与 Discourse 投票代码结合使用，以达到你想要的效果：

```plaintext

<details>
<summary>
隐藏投票
</summary>

[poll type=regular results=always chartType=bar]
* 选项 1
* 选项 2 
[/poll]

</details>

```

**示例：**

> **隐藏投票**
>
> _Poll ([view on site](https://meta.discourse.org/t/polls-within-hide-details/196150/2))_

* * *

**编辑：** 在我因发布第一条消息而兴奋不已之后，我回过头来查看了标准“隐藏详情”功能的表现，因为确实可以在投票上下方添加空白区域。

出于某种原因，它会将 `[/poll]` 和 `[/details]` 代码在末尾混合在一起。不知道这是否是预期行为，但如果你需要的话，上面的变通方法可以解决问题。👍

---

<div class="post-metadata">

### Author: ![kaidenh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kaidenh/32/220661_2.png) [@kaidenh](https://meta.discourse.org/u/kaidenh)
#### Post date: [2021年七月6日 18:00 UTC](https://meta.discourse.org/t/polls-within-hide-details/196150/3 "2021-07-06T18:00:25Z")

</div>

> **隐藏投票**
>
> _Poll ([view on site](https://meta.discourse.org/t/polls-within-hide-details/196150/3))_

[/quote]

谢谢 @JammyDodger

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2021年八月5日 18:01 UTC](https://meta.discourse.org/t/polls-within-hide-details/196150/4 "2021-08-05T18:01:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
