Fakebook 主题

说得太早了!我仔细看了一下,其实在发出上面的回复后不久就解决了这个问题。有时候把问题写出来就能找到答案。

我已经做了一个更新,现在只使用一个模板……默认情况下,在 topic-list-item.js 中我们有如下代码:

  renderTopicListItem() {
    const template = findRawTemplate("list/topic-list-item");
    if (template) {
      this.set("topicListItemContents", template(this).htmlSafe());
    }
  },

所以,如果我在主题中覆盖 const template

  renderTopicListItem() {
    const template = findRawTemplate("list/custom-topic-list-item");
    if (template) {
      this.set("topicListItemContents", template(this).htmlSafe());
    }
  },

这样就会指向一个单独的模板,而且由于没有同名的移动端对应模板……它也会被用于移动端。感谢你的提问 @hyd504 启发了这次改进!

4 个赞