2012-12-16 3 views
1

정의 :다트 웹 구성 요소를 인스턴스화하는 동안 속성을 통해 상수 또는 리터럴 데이터를 전달하는 방법은 무엇입니까?

<element name="x-card" constructor="Card" extends="div"> 
    <template> 
    <div>{{titleText}}</div> 
    </template> 
    <script type="application/dart"> 
    import 'package:web_ui/web_ui.dart'; 

    class Card extends WebComponent { 
     String titleText = ''; 
    } 
    </script> 
</element> 

인스턴스화 :

<x-card data-value="titleText:something"></x-card> 

또는

<x-card titleText="something"></x-card> 

아무것도 작동하지 않습니다. 여기 something은 변수가 아닙니다. 그것의 문자열 리터럴. 나는 그것을 어떻게 지나가는가? x-cards의 배열을 인스턴스화하려면 어떻게해야합니까? cardTitleArray이라는 다트 어레이가 있다고 가정 해보십시오. 실제 코드를 사용하여 같은 '데이터 값'을 참조 할 않는 코드를 보면

답변

4

@financeCoding, data-value는 더 이상 사용되지 않습니다. 그들은 data-value="attribute:value" 대신 attribute=value을 사용한다고 말합니다.

내 문제는 해결됩니다. 다음 작품들.

<x-card title-text="{{'Aint it supercool'}}"></x-card> 
+0

대신 financeCoding 답변에 대한 의견을 사용하십시오. –

+0

리터럴 속성을 작동시키는 공개 기능 요청이 있습니다. https://github.com/dart-lang/web-ui/issues/240 –

관련 문제