0

我的 .dart 文件将调用 prettify.js 中的函数 prettyPrint()。但是,此代码在 Darteditor 下正常工作,但在“pub build”生成的构建版本中失败。

<script src="packages/browser/dart.js"></script>
<script src="packages/browser/interop.js"></script> 
<!-- google prettify print -->
<script type="text/javascript" src="js/prettify.js"></script>  
library javascript;
import 'dart:js' as js;

void jsprettyPrint(){
  js.context.callMethod('prettyPrint');
}
<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <title>Dry</title>
      <link rel="stylesheet" href="css/dry.css">
      <link rel="stylesheet" href="css/bootstrap.css">
      <link rel="stylesheet" href="css/custom_ui.css">
      <link rel="stylesheet" href="css/main.css">
      <link href="css/prettify.css" type="text/css" rel="stylesheet" />
   </head>
   <body>
      <div class="container"><h5></h5></div>
      <!-- end container-->
      <div id="x-matrix" class="container"></div>
      <!-- JQuery -->
      <script src="//code.jquery.com/jquery.js"></script>
      <script src="js/bootstrap.min.js"></script>  
      <script type="application/dart" src="dartscripts/pages/main.dart"></script>
      <script src="packages/browser/dart.js"></script>
      <script src="packages/browser/interop.js"></script>   
      <!-- fix header table -->
      <script src="js/jquery.fixedheadertable.min.js"></script>
      <!-- google prettify print -->
      <script type="text/javascript" src="js/prettify.js"></script>
   </body>
</html>
4

0 回答 0