【问题标题】:Repeatable attribute tags in markojsmarkojs 中的可重复属性标签
【发布时间】:2019-11-06 06:03:51
【问题描述】:

我想要一个标签的自定义标签,让我可以编写以下代码

app-tabset#my-tab
  @tab title="first"
    p -- content of first tab
  @tab title="second"
    p -- content of second tab

但我不能让它消耗重复的属性,因此在app-tabset.marko

onMount() {
  console.log('incoming tabs', this.input.tab)
  // expected an array but only object of second tab
  //  "{title="second", renderBody: function}"
}

阅读docs in repeated attribute tags我添加了marko-tag.json

{
  "<tab>": {
    "is-repeated": true
  }
}

这编译得很好,但是在加载页面时我得到了

Render async fragment error (lasso-slot:head).
Exception: Error: Unable to load tag ([C:\projects\marko\src\components → C:\projects\marko\src\components\app-tabset\marko-tag.json]):
Error: Error while applying option of "<tab>".
Cause: Error: Unsupported properties of [is-repeated]

【问题讨论】:

    标签: marko


    【解决方案1】:

    如果您还没有找到解决方案,请在您的 marko-tag.json 文件中尝试此操作

    {
        "@tabs <tab>[]": {
            "@title": "string"
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-03-09
      • 2017-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-26
      • 2011-12-14
      • 1970-01-01
      相关资源
      最近更新 更多