# 能否通过插件或主题组件系统修改辅助函数中的函数？

**URL:** https://meta.discourse.org/t/is-it-possible-to-modify-a-function-in-a-helper-via-the-plugin-or-theme-component-system/140964
**Category:** Development
**Created:** [2020年二月7日 08:09 UTC](https://meta.discourse.org/t/is-it-possible-to-modify-a-function-in-a-helper-via-the-plugin-or-theme-component-system/140964 "2020-02-07T08:09:35Z")
**Posts on this page:** 1
**Page:** 2

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [2020年九月28日 22:18 UTC](https://meta.discourse.org/t/is-it-possible-to-modify-a-function-in-a-helper-via-the-plugin-or-theme-component-system/140964/21 "2020-09-28T22:18:51Z")

</div>

如果您想更改页面加载时显示的加载动画的 HTML，那么

`discourse\helpers\loading-spinner.js`

可能不是您要找的文件。该辅助函数生成的是您在编辑器、搜索菜单等处看到的小加载动画。

如果您想更改页面加载时显示的主加载动画，那么您需要查看以下文件：

[discourse/app/assets/javascripts/discourse/app/templates/components/conditional-loading-spinner.hbs at 7a2e8d3ead63c7d99e1069fc7823e933f931ba85 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/7a2e8d3ead63c7d99e1069fc7823e933f931ba85/app/assets/javascripts/discourse/app/templates/components/conditional-loading-spinner.hbs)

您可以按如下方式覆盖该加载动画的模板：

```markdown
<script type="text/x-handlebars" data-template-name="components/conditional-loading-spinner">
{{#if condition}}
  <!-- 您的自定义加载动画的 HTML 代码放在这里 -->
{{else}}
  {{yield}}
{{/if}}
</script>

```

将其放在主题或主题组件的 `<head>` 标签中，然后为自定义加载动画添加所需的 CSS 样式。

[上一頁](https://meta.discourse.org/t/is-it-possible-to-modify-a-function-in-a-helper-via-the-plugin-or-theme-component-system/140964.md?page=1)
