简体   繁体   English

聚合物应用程序中没有自定义元素

[英]No custom elements in polymer app

I have a polymer app that runs fine i Dartium, but when I export to javascript it will not run. 我有一个可以在Dartium上正常运行的聚合物应用程序,但是当我导出为javascript时它将无法运行。 There are no error messages, but I get this warning: 没有错误消息,但我收到此警告:

Target of URI does not exist: 'maindocument.html.0.dart' URI的目标不存在:“ maindocument.html.0.dart”

It refers to this line: 它指的是这一行:

<script type="application/dart" src="maindocument.html.0.dart"></script>

in a file called 'maindocument.html' created by the build. 在由构建创建的名为“ maindocument.html”的文件中。

This is the 'original' 'maindocument.html': 这是“原始”“ maindocument.html”:

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    <title>Sample app</title>
    <link rel="stylesheet" href="maindocument.css">

    <link rel="import" href="maincontroller.html">

    <script type="application/dart">export 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
  </head>
  <body>

    <div id="sample_container_id">
      <main-controller></main-controller>
    </div>

  </body>
</html>

This is 'maincontroller.html': 这是“ maincontroller.html”:

<link rel="import" href="postedItem.html">

<polymer-element name="main-controller">
  <template>
    <style>
    </style>
    <div>
      <posted-item></posted-item>
    </div>
  </template>
  <script type="application/dart" src="maincontroller.dart"></script>
</polymer-element>

'maincontroller.dart' has no functionality yet. 'maincontroller.dart'还没有功能。 Is it a problem with nested custom elements? 嵌套的自定义元素有问题吗?

If maincontroller.dart does not have a definition for MainController with a CustomTag annotation, then you'll have problems. 如果maincontroller.dart没有使用CustomTag注释的MainController定义,那么您将遇到问题。

Try defining a MainController class or add a noscript attribute to your <polymer-element> tag if you don't need any code for your element. 如果不需要任何代码,请尝试定义MainController类或将noscript属性添加到<polymer-element>标记中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM