问问题
349 次
1 回答
5
Here is the Dart code:
import 'dart:html';
import 'package:web_ui/web_ui.dart';
List<String> fruits = const <String>['apples', 'bananas', 'pears'];
@observable
String selected = 'pears';
void main() { }
Here is the HTML code:
<p>Hello world from Dart! You chose {{ selected }}</p>
<select name="fruit" template iterate="fruit in fruits" bind-value="selected">
<option selected="{{selected == fruit}}">{{fruit}}</option>
</select>
Note, there is an open request to make this a bit easier. In the meantime, the above code should work for you.
于 2013-04-18T17:26:01.143 回答