@@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';
22import { CommonModule } from '@angular/common' ;
33import { egesig } from "../../enums/letter" ;
44import { FormsModule } from "@angular/forms" ;
5+ import { LIST , LIST2 } from "./data" ;
56
67@Component ( {
78 selector : 'app-index' ,
@@ -14,37 +15,10 @@ export class IndexComponent implements OnInit {
1415 constructor ( ) {
1516 }
1617
17- public egesig : Array < [ string , string ] > = egesig ;
18- public latinToMonggol : any = { } ;
19- public valueLatin = 'minw saihan monggol oron' ;
20- public valueMonggol = '' ;
21-
2218 ngOnInit ( ) : void {
23- this . egesig . forEach ( ( res : [ string , string ] ) : void => {
24- this . latinToMonggol [ res [ 1 ] ] = res [ 0 ] ;
25- } )
26- console . log ( this . latinToMonggol )
27- }
2819
29- valueLatinChange ( ) : void {
30- // const newMGStr: any = this.valueLatin.replace(/(zqi|cqi|sqi|eqr|eqr) /gi, '$1, ');
31- const letterArry : any = this . valueLatin . split ( '' ) ;
32- let mgWord : string = '' ;
33- letterArry . forEach ( ( v : string ) : void => {
34- console . log ( v . toUpperCase ( ) )
35- if ( this . latinToMonggol [ v . toUpperCase ( ) ] ) {
36- mgWord += this . latinToMonggol [ v . toUpperCase ( ) ] ;
37- } else {
38- mgWord += v ;
39- }
40- } )
41- this . valueMonggol = mgWord ;
42- console . log ( letterArry ) ;
43- console . log ( mgWord )
4420 }
45- }
4621
47- /*
48- 请使用js实现如下要求,
49- 有一段文字,kjaah shfd gjlqkd hadt hfzqijhg kdfjh skjshdfh,所有'sqi '的后面都插入一个逗号,
50- * */
22+ public list : any [ ] = LIST ;
23+ public list2 : any [ ] = LIST2 ;
24+ }
0 commit comments