creator 1.7 以上版本 evaluateJS 如果正确把cosos 数据传递到webview?

////////////////////////////////////

cc.Class({
extends: cc.Component,

properties: {
    webViewNode: {
        default: null,
        type: cc.Node,
    },
    webView: {
        default: null,
        type: cc.WebView,
    }
},

// LIFE-CYCLE CALLBACKS:

onLoad() {
    cc.find("Canvas/size").getComponent(cc.Label).string = cc.view.getVisibleSizeInPixel();
    cc.find("Canvas/RootNode/LeftNode").getComponent(cc.Label);

    this.initWebViewSize();

    //this.webView.url = 'https://m.baidu.com';

    var ss = "555555";

    //this.webView.evaluateJS('onClick1('+ss+')');
},

start() {

},

btnAction: function() {

    Alert.show("难道还有这种操作?");
},

initWebViewSize: function() {
    console.log("leftheight=" + cc.find("Canvas/RootNode/LeftNode").height);
    console.log("leftwidth=" + cc.find("Canvas/RootNode/LeftNode").width);
    var viewSize = cc.view.getVisibleSizeInPixel();
    var viewWidth = (viewSize.width / viewSize.height) * 720 - 98;
    var viewPaddingWidth = viewSize.width - 98;
    console.log("viewSize=" + JSON.stringify(viewSize) + " ;viewWidth=" + viewWidth + ";viewPaddingWidth=" + viewPaddingWidth);
    this.webViewNode.width = viewWidth;
    console.log("this.webViewNode.x=" + this.webViewNode.x + ";this.webViewNode.y=" + this.webViewNode.y);

},

// update (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);
},

});

///////////////////////////////////////////////////////////////
错误提示

eruda.min.js:2 DOMException: Blocked a frame with origin “http://localhost:7456” from accessing a cross-origin frame.
at TheClass.evaluateJS (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:41126:17)
at PWebView.evaluateJS (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:19196:38)
at MallHome.onWebFinishLoad (http://localhost:7456/preview-scripts/assets/scripts/mall/MallHome.js:62:26)
at cc_ClickEvent.emit (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:14891:17)
at Function.emitEvents (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:14876:19)
at PWebView._onWebViewLoaded (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:19177:35)
at TheClass._dispatchEvent (http://localhost:7456/app/engine/bin/cocos2d-js-for-preview.js:41144:30)

这个应该是跨域导致的,最好自行找网上的方案

下面这个有一个 domain 的可以试看看
http://www.jianshu.com/p/c71c20e98f94

domain,好想不行,本地测试域名是localhost,访问网址是其它域名