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