0

走った後

private/dart/dart-sdk/bin/dart2js -m -o public/js/script.js private/dart/script.dart

結果のJavaScriptが返されます

TypeError: 'null' is not an object (evaluating 'J.RE(a).gVs')

ただし、縮小されていない間のエラーは

TypeError: 'null' is not an object (evaluating 'J.getInterceptor$x(receiver).get$onBlur')

どちらがより意味があるかもしれません。

これは、script.js と script.compiled.js のどちらを使用しても実行されます。

ダーツコードは

import 'dart:html';
import 'dart:core';

void main() {
   querySelector("#authorInput").onBlur.listen(updateSurname);
}
void updateSurname(Event e){
   String author = (e.target as InputElement).value;
   String surname = author.split(' ').last;
   querySelector("#surnameInput").text = surname;
}

関連するhamlは

  .form-group
     %label(for="authorInput") Author
     %input.form-control#authorInput(type="text" name="author" placeholder="Enter author")
  .form-group
     %label(for="surnameInput") Surname
     %input.form-control#surnameInput(type="text" name="surname" placeholder="Enter surname")

明らかにそうではありませんが、そのままで機能するはずだと思います。

4

1 に答える 1

1

理解した。

コンパイルした JavaScript ファイルを HTML ページのタグ内に含めました。それを体の一番下に移動すると、すべてが修正されました。

于 2014-03-18T20:41:47.127 に答える