如何使用Ember CLI在两个组件之间共享模板? [英] How can I share a template between two components using Ember CLI?
问题描述
我有两个组件: SpecialButtonComponent
和 SpecialButtonDerivativeComponent
。
SpecialButton
组件自动使用在 /app/templates/components/special-button.hbs上找到的模板
我想要 SpecialButtonDerivativeComponent
使用相同的模板,但到目前为止我没有运气尝试要使用这种技术:
// app / components / special-button-derivative.js
import SpecialButtonComponent from './special-button';
export defaultButtonComponent.extend({
templateName:'components / special-button'
});
我还试过使用 layoutName
的 templateName
,但还是没有运气。任何想法?
组件没有 templateName
p>
我将尝试将 layout
设置为null,然后指定一个 layoutName
。
I have two components: SpecialButtonComponent
and SpecialButtonDerivativeComponent
.
The SpecialButton
component automatically uses the template found at /app/templates/components/special-button.hbs
.
I would like for SpecialButtonDerivativeComponent
to use the same template, but so far I'm having no luck trying to go with this technique:
// app/components/special-button-derivative.js
import SpecialButtonComponent from './special-button';
export default SpecialButtonComponent.extend({
templateName: 'components/special-button'
});
I've also tried using layoutName
instead of templateName
, but still no luck. Any ideas?
Components do not have a templateName
.
I would try to set layout
to null and then specify a layoutName
.
这篇关于如何使用Ember CLI在两个组件之间共享模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!