【问题标题】:Dart Todo ApplicationDart Todo 应用程序
【发布时间】:2014-07-12 19:00:00
【问题描述】:

我正在研究 dart todo 示例应用程序。我没有更改任何代码,但我在编辑器中看到了很多曲线。

    <polymer-element name="simple-router">
        <script type="application/dart;component=1" 
         src="simple_router.dart"></script>
    </polymer-element>

我看到的错误读取。

错误的脚本类型,预期 type="应用程序/飞镖"。

我不明白这是什么意思。当我剥离 ;component=1.它真的破坏了应用程序。

【问题讨论】:

    标签: dart dart-polymer


    【解决方案1】:

    这是关于 "&gt;= 0.10.5 &lt;0.11.0" 在 Polymer 中有效的代码,但有几处更改。

    ;component=1 应该从所有脚本标签中删除。

    入口页面中的导入和脚本标签应如下所示

    <html>
      <head>
        <title>core-ajax-dart</title>
    
        <!-- when the project uses polymer -->
        <!-- <script src="packages/web_components/platform.js"></script>
             not necessary anymore with Polymer >= 0.14.0 -->
        <script src="packages/web_components/dart_support.js"></script>
    
        <!-- import individual polymer elements -->
        <link rel='import' href='packages/core_elements/core_ajax_dart.html'>
      </head>
      <body>
        <core-ajax-dart
          url="http://gdata.youtube.com/feeds/api/videos/"
          params='{"alt":"json", "q":"chrome"}'
          handleAs="json"
          auto></core-ajax-dart>
    
        <!-- if you have a custom script file that contains a main() method -->
        <script type="application/dart" src="core_ajax_dart.dart"></script>
    
        <!-- else if you don't have a custom script file with a main() method 
        <script type="application/dart">export 'package:polymer/init.dart';</script>
      </body>
    </html>
    

    在此处查看如何实现自定义 main 方法。 how to implement a main function in polymer apps

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-27
      • 2013-07-27
      • 1970-01-01
      • 2013-02-20
      • 1970-01-01
      相关资源
      最近更新 更多