weexteam / devtool-for-Apache-Weex

debugger tools with chrome devtool for Apache Weex
MIT License
258 stars 40 forks source link

debug #36

Closed spiritelf closed 6 years ago

spiritelf commented 7 years ago

weex debug main.we 这个模式下调试有问题,内容加载不了,这是什么问题?是怎么跳转页面的?

NetWork failure :wx_network_error, error message :Protocol not found: /dist/modules/main.js

exolution commented 7 years ago

能贴一下main.we的代码么 看起来是代码写的有问题

spiritelf commented 7 years ago

/**

// var stream = require('@weex-module/stream');//说是0.15已经支持,但是我没生效

var stream weex_define('@weex-temp/api', function (weex_require) { stream = __weex_require__('@weex-module/stream') });

var apiURL = { baseurl: 'http://v3.wufazhuce.com:8000/api', homePage: '/hp/bymonth/', readingCarousel: '/reading/carousel', readingIndex: '/reading/index/', essay: '/essay/', serialcontent: '/serialcontent/', question: '/question/', carouselList: '/reading/carousel/', movieList: '/movie/list/', movieDetail: '/movie/detail/'

}; function getData(url, callback) { stream.sendHttp({ method: 'GET', url: url }, function (ret) { var retdata = JSON.parse(ret); callback(retdata); }); } exports.getHome = function (dateStr, callback) { getData(apiURL.baseurl + apiURL.homePage + dateStr, callback); }; exports.getReadingCarousel = function (callback) { getData(apiURL.baseurl + apiURL.readingCarousel, callback); }; exports.getReadingIndex = function (index, callback) { getData(apiURL.baseurl + apiURL.readingIndex + index, callback); }; exports.getEssay = function (id, callback) { getData(apiURL.baseurl + apiURL.essay + id, callback); }; exports.getSerialContent = function (id, callback) { getData(apiURL.baseurl + apiURL.serialcontent + id, callback); }; exports.getQuestionDetail = function (id, callback) { getData(apiURL.baseurl + apiURL.question + id, callback);

}; exports.getCarouseList = function (id, callback) { getData(apiURL.baseurl + apiURL.carouselList + id, callback); }; exports.getMovieList = function (id, callback) { getData(apiURL.baseurl + apiURL.movieList + id, callback); }; exports.getMovieDetail = function (id, callback) { getData(apiURL.baseurl + apiURL.movieDetail + id, callback);

};

exports.getBaseUrl = function (bundleUrl, isnav) { bundleUrl = new String(bundleUrl); var nativeBase; var isAndroidAssets = bundleUrl.indexOf('file://assets/') >= 0;

var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexDemo.app') > 0;
if (isAndroidAssets) {
    nativeBase = 'file://assets/dist/';
}
else if (isiOSAssets) {
    nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1);
}
else {
    var host = 'localhost:12580';
    var matches = /\/\/([^\/]+?)\//.exec(bundleUrl);
    if (matches && matches.length >= 2) {
        host = matches[1];
    }

    //此处需注意一下,tabbar 用的直接是jsbundle 的路径,但是navigator是直接跳转到新页面上的.
    if (typeof window === 'object') {

        nativeBase = isnav ? 'http://' + host + '/index.html?page=./dist/' : '/dist/';
    } else {
        nativeBase = 'http://' + host + '/dist/';
    }
}
return nativeBase;

};

我运行的是weexone这个项目,html5模式可以加载,但是用这种模式好像就加载不了 不知道什么回事

exolution commented 7 years ago

目前 weex debug是没法调试h5的 如果你想在手机上看效果 建议你使用weexpack 直接打出app 在手机运行 weexpack工具地址 https://github.com/weexteam/weex-pack 下面这篇文章会手把手教你 如何打个weexone app https://github.com/weexteam/weex-pack/wiki/Create-Weex-One-App-with-Weexpack

spiritelf commented 7 years ago

你好 有什么好办法调试js文件里内容啊?