如何通过名称从实例字段渲染组件/助手? [英] How to render component/helper by name from instance field?

查看:65
本文介绍了如何通过名称从实例字段渲染组件/助手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所以不用使用

  {{contact-select label =Label:contacts = form.prop}} 
//或
{{input-field label =Label:contacts = form .prop}}
//或
{{datepicker-component label =Label:contacts = form.prop}}

使用一些像

  {{context.helperName label =Label: contacts = form.prop}} 

我尝试使用ember-helpers-render-component,从属性获取组件名称

解决方案

您可以使用组件助手,在1.11.0中引入。不幸的是,在1.11.0之前没有内置的方法。如果您无法升级,此线程可以点你在写自己的帮手的方向。


Is there way to use component from controller/view field

So instead of using

{{contact-select label="Label:" contacts=form.prop}}
// or
{{input-field label="Label:" contacts=form.prop}}
// or
{{datepicker-component label="Label:" contacts=form.prop}}

use some like

{{context.helperName label="Label:" contacts=form.prop}}

I try use ember-helpers-render-component but it doesn't take component name from property

解决方案

You can use the component helper that was introduced in 1.11.0. Unfortunately there was no built-in way to do it before 1.11.0. If you're not able to upgrade, this thread can point you in the direction of writing your own helper.

这篇关于如何通过名称从实例字段渲染组件/助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆