传递参数到Dart Polymer元素

编程入门 行业动态 更新时间:2024-10-21 14:34:56
本文介绍了传递参数到Dart Polymer元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Dart Polymer唯一可以找到的实例不使用任何参数。如何将参数传递给模板。是通过构造函数完成的吗?

The only solid example I could find for Dart Polymer doesn't use any parameters. How can I pass parameters to the template. Is it done through the constructor?

我的具体例子是我有一个卡元素的标题,我想通过卡的标题作为字符串

My specific example is that I have a card element with a title, and I want to pass the title of the card as a string to the element.

我看过将数据传递给Polymer元素

但这不完全是我想要做的。我想从dart代码中传递数据。

but this is not exactly what I want to do. I want to pass data from within dart code.

推荐答案

元素的构造函数从Polymer调用,没有办法传递

The constructor of elements is called from Polymer and there is no way to pass parameters.

您可以像@Vloz所写,在元素创建后分配值,或者您可以使用绑定,如链接的问题(将数据传递到Polymer元素)使用绑定。

You can as @Vloz wrote, assign values after the element was created or you can use binding as in the question you linked (Passing data to a Polymer element) using bindings.

更多推荐

传递参数到Dart Polymer元素

本文发布于:2023-08-02 11:41:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1277513.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:元素   参数   Dart   Polymer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!