[mod] iOS可以用的溝通Cocos
This commit is contained in:
parent
b4571e07aa
commit
cfe31371af
@ -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"];
|
||||||
|
Loading…
Reference in New Issue
Block a user