[mod] iOS可以用的溝通Cocos

This commit is contained in:
建喵 2022-08-29 13:56:24 +08:00
parent b4571e07aa
commit cfe31371af

View File

@ -65,7 +65,7 @@ export default class Manager extends cc.Component {
let scheme: string = "http"; let scheme: string = "http";
this.webview.setJavascriptInterfaceScheme(scheme); this.webview.setJavascriptInterfaceScheme(scheme);
this.webview.setOnJSCallback((sender: any, url: any) => { this.webview.setOnJSCallback((sender: any, url: any) => {
let content: string = decodeURI(url.split(`${scheme}://`)[1]); let content: string = decodeURI(url.split(`${scheme}://?data=`)[1]);
try { try {
let data: JSON = JSON.parse(content); let data: JSON = JSON.parse(content);
let method: any = data["method"]; let method: any = data["method"];