Aurelia 在选择框内使用组件

Aurelia 在选择框内使用组件,aurelia,Aurelia,我试图在select元素中使用自定义组件,例如: <select value.bind="selectValue" name="myname"> <option value="" disabled selected>Select option</option> <my-component></my-component> </select> <template> <option value="

我试图在select元素中使用自定义组件,例如:

<select value.bind="selectValue" name="myname">
  <option value="" disabled selected>Select option</option>

  <my-component></my-component>
</select>
<template>
  <option value="something">Some text</option>
</template>
所以我希望这个选项包含在我的select中

但似乎它不起作用了

我的问题是:在使用select时,是否不能在其中使用自定义组件

干杯

因为只接受和,所以不能在其中使用自定义元素。但是,可以使用as元素来避免此错误。像这样:

<select value.bind="selectValue" name="myname">
  <option value="" disabled selected>Select option</option>

  <option as-element="my-component"></option>
</select>

但在使用这种方法之前,请确保我的组件在这种情况下确实有意义。在使用自定义元素渲染简单内容之前,我会三思而后行,例如。也许自定义属性会是一个更好的选择。

我可能错了,但我认为只能有或作为孩子。我不知道select中自定义元素的行为。@adiga似乎是正确的。我在gistRun中玩过这个,即使使用compose也无法让它工作。