Cocos Creator 1.7以上(含),如何把cocos数据传递到h5页面上,该如何做?
///////////////////////////////////////////////////////////////我的代码/////////////////////////////
cc.Class({
extends: cc.Component,
properties: {
webView: {
default: null,
type: cc.WebView,
},
},
// use this for initialization
onLoad: function () {
this.webView.evaluateJS('onClick()');
},
// called every frame
update: function (dt) {
},
onWebFinishLoad: function(sender, event) {
console.log("onWebFinishLoad == =" + sender);
var loadStatus = "";
if (event === cc.WebView.EventType.LOADED) {
var ss = "sss565454";
this.webView.evaluateJS('onClick1('+ss+')');
loadStatus = " is loaded!";
} else if (event === cc.WebView.EventType.LOADING) {
loadStatus = " is loading!";
} else if (event === cc.WebView.EventType.ERROR) {
loadStatus = ' load error!';
}
console.log("onWebFinishLoad=" + loadStatus);
},
});
///////////////////////////////////////////////////////////////////我的html代码///////////////////////////////