Commit 87da2d5f authored by 李彥志's avatar 李彥志

update 題三

parent 3b42d864
<p style="color:green">題三</p> <p style="color:green">題三</p>
<!-- 圖片無法顯示QQ -->
寬度 : <input type="number" min="1" step="5" ><br> WidthLength : <input type="number" min="1" step="5" [(ngModel)]="widthLength" (change)="showPic()" ><br>
高度 : <input type="number" min="1" step="5"><br> HeightLength : <input type="number" min="1" step="5" [(ngModel)]="heightLength" (change)="showPic()"><br>
<img src ="imageUrl">
<img [src]=" imageUrl "> <img [src]='imageUrl '/>
<img bind-src="imageUrl ">
<router-outlet></router-outlet> <router-outlet></router-outlet>
...@@ -9,19 +9,21 @@ export class P3Component implements OnInit { ...@@ -9,19 +9,21 @@ export class P3Component implements OnInit {
widthLength = '1024'; widthLength = '1024';
heightLength = '768'; heightLength = '768';
imageUrl = 'http://lorempixel.com/{{widthLength}}/{{heightLength}}/'; imageUrl = null;
ngOnInit() {
this.showPic();
}
showPic() { showPic() {
if (this.widthLength !== null && this.heightLength !== null && if (this.widthLength !== null && this.heightLength !== null &&
this.widthLength !== undefined && this.heightLength !== undefined) { this.widthLength !== undefined && this.heightLength !== undefined) {
this.imageUrl = 'http://lorempixel.com/' + this.widthLength + '/' + this.heightLength + '/'; this.imageUrl = 'https://lorempixel.com/' + this.widthLength + '/' + this.heightLength + '/';
} else { } else {
alert('長度或高度不得為空!'); alert('null');
} }
} }
constructor() { } constructor() { }
ngOnInit() { }
} }
...@@ -49,7 +49,7 @@ export class P4Component implements OnInit { ...@@ -49,7 +49,7 @@ export class P4Component implements OnInit {
if ( if (
this.value2 !== Number this.value2 !== Number
) { ) {
alert('只能輸入數字'); alert('欄位只能輸入英文兩碼 + 數字三碼');
} else { } else {
alert('輸入正確'); alert('輸入正確');
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment