更新test.dart
This commit is contained in:
parent
db4b4c45c5
commit
137f377317
File diff suppressed because one or more lines are too long
@ -2,6 +2,9 @@
|
||||
import 'dart:js' as Js;
|
||||
import 'dart:html';
|
||||
|
||||
abstract class IPlr {}
|
||||
|
||||
class NPlr extends IPlr {}
|
||||
|
||||
SpanElement Span(String cls) {
|
||||
return new SpanElement()..classes.add(cls);
|
||||
@ -10,7 +13,8 @@ SpanElement Span(String cls) {
|
||||
DivElement Div(String cls) {
|
||||
return new DivElement()..classes.add(cls);
|
||||
}
|
||||
TableCellElement TD(TableRowElement tr){
|
||||
|
||||
TableCellElement TD(TableRowElement tr) {
|
||||
TableCellElement td = new TableCellElement();
|
||||
tr.append(td);
|
||||
return td;
|
||||
@ -23,6 +27,7 @@ ParagraphElement P(String cls) {
|
||||
String b(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
String smile(String str) {
|
||||
return '<div class="smile s_$str"></div>';
|
||||
}
|
||||
@ -31,6 +36,13 @@ String l(String str, String key) {
|
||||
return str;
|
||||
}
|
||||
|
||||
num drawText(CanvasRenderingContext2D ctx, String txt, int x, int y, int w,
|
||||
bool center) {
|
||||
TextMetrics tm = ctx.measureText(txt);
|
||||
ctx.fillText(txt, x, y + 15, w);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
// Find an element by id (an-id).
|
||||
Element idElement = querySelector('#an-id')!;
|
||||
@ -41,13 +53,25 @@ void main() {
|
||||
// Find all elements by tag (<div>).
|
||||
List<Element> divElements = querySelectorAll('div');
|
||||
|
||||
TableRowElement tr = new TableRowElement();
|
||||
TD(tr)..text = l('击杀','killedCount')..style.width = '44px';
|
||||
TD(tr)..text = l('致命一击','killerName')..style.minWidth = '112px';
|
||||
TableRowElement tr = new TableRowElement();
|
||||
TD(tr)
|
||||
..text = l('击杀', 'killedCount')
|
||||
..style.width = '44px';
|
||||
TD(tr)
|
||||
..text = l('致命一击', 'killerName')
|
||||
..style.minWidth = '112px';
|
||||
|
||||
var plr = new NPlr();
|
||||
|
||||
DivElement plist = document.querySelector('.plist') as DivElement;
|
||||
DivElement pbody = document.querySelector('.pbody') as DivElement;
|
||||
|
||||
DivElement p = Div('p');
|
||||
|
||||
p.append(tr);
|
||||
pbody.append(p);
|
||||
plist.append(pbody);
|
||||
|
||||
print(idElement);
|
||||
print(classElement);
|
||||
print(divElements);
|
||||
|
Loading…
Reference in New Issue
Block a user