我试图理解core-style
。我注意到,到目前为止,在我看到的所有示例中,只有 Button 等元素在 a 中被引用core-style
- 没有类引用(例如.blue
)。我试图在其中放置一个类引用,core-style
但它没有呈现。请看下面的例子
.html
<link href='../../../../packages/polymer/polymer.html' rel='import' >
<link href='../../../../packages/core_elements/core_style.html' rel='import' >
<polymer-element name='blue-theme'>
<template>
<core-style id='blue-theme'>
:host {
background-color: red;
.lb-container1 {
background-color: {{lb50}};
padding-top: 5px;
padding-bottom: 5px;
width: {{width}}
}
}
</core-style>
</template>
<script type='application/dart' src='blue_theme.dart'></script>
</polymer-element>
。镖
import 'package:polymer/polymer.dart';
import 'package:epimss_shared/epimss_shared_client.dart' hide DataEvent;
@CustomTag( 'blue-theme' )
class BlueTheme extends PolymerElement
{
String topic = '';
@observable String lb50 = LightBlue['50'];
@observable String lb100 = LightBlue['100'];
@observable String lb200 = LightBlue['200'];
BlueTheme.created() : super.created();
@published
String get width => readValue( #width );
set width(String value) => writeValue( #width, value );
@override
void attached()
{
super.attached();
topic = this.dataset['topic'];
}
}
上面的代码不渲染。
谢谢