2
下工作正常,爲什麼我不能使用Dart中的實例化參數選擇內容?
<!DOCTYPE html>
<html>
<body>
<element name="x-editable" constructor="EditableComponent" extends="div">
<template>
<div style="display: {{editing ? 'block' : 'none'}}">
<content select=".editing"></content>
</div>
<div style="display: {{editing ? 'none' : 'block'}}">
<content select=".normal"></content>
</div>
<script type="application/dart" src="xeditable.dart"></script>
<script src="packages/browser/dart.js"></script>
</template>
</element>
</body>
</html>
它抓住所有的孩子中x-editable
有.editing
和.normal
,並顯示他們根據布爾editing
是否是真還是假。
但是,以下不能正常工作,
<!DOCTYPE html>
<html>
<body>
<element name="x-editable" constructor="EditableComponent" extends="div">
<template>
<template instantiate="if editing">
<content select=".editing"></content>
</template>
<template instantiate="if !editing">
<content select=".normal"></content>
</template>
<script type="application/dart" src="xeditable.dart"></script>
<script src="packages/browser/dart.js"></script>
</template>
</element>
</body>
</html>
它沒有搶到任何.editing
或.normal
孩子。顯然,我做錯了什麼,但是什麼?
你能展示一個將組件分成幾部分的例子嗎? – 2013-05-07 07:10:41