使用Polymer

时间:2015-05-03 22:09:41

标签: dart dart-polymer

刚刚在Windows 8平台上升级到Dart SDK版本1.10.0。生成的样品聚合物应用程序在main_app.html中添加了以下行:

<input type="date" value="{{dob}}"/>

以及以下指向main_app.dart的行:

 @observable String dob = '';

代码生成以下错误: 无法加载资源:net :: ERR_CACHE_MISS https://ssl.gstatic.com/chrome/components/doodle-notifier-01.html 天文台在http://127.0.0.1:50511/

完整的应用程序如下: main_app.dart:

import 'dart:html';
import 'package:paper_elements/paper_input.dart';
import 'package:polymer/polymer.dart';
/// A Polymer `<main-app>` element.
@CustomTag('main-app')
class MainApp extends PolymerElement {
  @observable String reversed = ''; 

  @observable String dob = '';   //added this line

  /// Constructor used to create instance of MainApp.
  MainApp.created() : super.created();

  void reverseText(Event event, Object object, PaperInput target) {
   reversed = target.value.split('').reversed.join('');
  }
}

main_app.html

<link rel="import" href="../../packages/polymer/polymer.html">
<link rel="import" href="../../packages/paper_elements/paper_input.html">
<polymer-element name="main-app">
  <template>
   <style>
    :host {
      display: block;
    }
   </style>
   <paper-input label="Type something..." on-keyup="{{reverseText}}">
   </paper-input>
   <p>
       Reversed: {{ reversed }}
   </p>
   <input type="date" value="{{dob}}"/> 
 </template>
  <script type="application/dart" src="main_app.dart"></script>
</polymer-element>

0 个答案:

没有答案