5

Dart を使用するのは初めてです。イベントに基づいてポップアップ ウィンドウを作成するにはどうすればよいでしょうか。イベントの作成方法は知っていますが、ポップアップ ウィンドウの作成方法がわかりません。

void main()
{
  List<Element> radioButtons = queryAll(".requestType");
  Iterator i = radioButtons.iterator();
  while(i.hasNext)
  {
    var item = i.next();
    item.on.click.add(addRequestTypeEvent);
  }
}

void addRequestTypeEvent(Event event) {
    <POPUP WINDOW>
}

2013 年 1 月 17 日更新: 方法がわかりました。

 window.open("http://www.yahoo.com", "yahoo", "status = 1, height = 300, width = 300, resizable = 0");
4

1 に答える 1

5

Window.openを使用するだけです:

window.open(url, name);

MDNoptionsの 3 番目のパラメーターとして指定できるものについて詳しく読むことができます。

もう 1 つ、コードを単純化できます。以下は同じことを行います:

void main()
{
  final radioButtons = queryAll(".requestType");

  // with forEach method
  radioButtons.forEach((item) => item.on.click.add(addRequestTypeEvent));

  // with for loop
  for (final item in radioButtons) {
    item.on.click.add(addRequestTypeEvent);
  }
}
于 2013-01-17T21:30:39.733 に答える