以下工作正常,
<!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
孩子。显然,我做错了什么,但是什么?