Advertisement

阅读量:

(一)ts 向 html 传递参数以及 ts 调用 html 中的方法

index.html

复制代码
 <script type="text/javascript">

    
 function Read(url){
    
 			console.log("这是html里",url)
    
 		}
    
 </script>	
    
    
    
    

GameMain.ts

复制代码
 constructor() {

    
     window["Read"]("传值");
    
 }
    
    
    
    

(二)ts 传方法给html

index.html

复制代码
 function Read(url,cb){

    
 			console.log("这是html里==》",url)
    
 			cb("html给的值")
    
 		}
    
    
    
    

GameMain.ts

复制代码
 private str_text = null;

全部评论 (0)

还没有任何评论哟~