邵佳豪
2 years ago
4 changed files with 32 additions and 30 deletions
@ -1,3 +1,3 @@
|
||||
<div class="box"> |
||||
<textarea name="" id="">{{data}}</textarea> |
||||
<textarea name="" id="">{{newList}}</textarea> |
||||
</div> |
@ -1,17 +1,27 @@
|
||||
import { Component, Input, OnInit } from '@angular/core'; |
||||
import { Component, Input, OnInit } from "@angular/core"; |
||||
|
||||
@Component({ |
||||
selector: 'app-img-list', |
||||
templateUrl: './img-list.component.html', |
||||
styleUrls: ['./img-list.component.scss'] |
||||
selector: "app-img-list", |
||||
templateUrl: "./img-list.component.html", |
||||
styleUrls: ["./img-list.component.scss"], |
||||
}) |
||||
export class ImgListComponent implements OnInit { |
||||
@Input() data?: any; |
||||
|
||||
@Input() data?: string; |
||||
|
||||
constructor() { } |
||||
constructor() {} |
||||
|
||||
newList; |
||||
ngOnInit(): void { |
||||
let str = ""; |
||||
let num = 0; |
||||
this.data.forEach((element) => { |
||||
num++; |
||||
if (element.indexOf("http") !== 0) { |
||||
str += location.origin + element + "\n"; |
||||
} else { |
||||
str += element + "\n"; |
||||
} |
||||
}); |
||||
this.newList = str; |
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue