(一)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;
constructor() {
let inst = this;
window["Read"]("传值",function (text) {
console.log("这是ts方法:"+text