android列表加载失败,weex中使用懒加载,代码无法在android中运行,出现错误" Can't find variable: window"...

在将Weex应用打包后,Android端运行时出现错误'Can't find variable: window'。问题可能源于打包后的代码在Android环境中找不到window变量。错误出现在webpack打包后的代码中,可能与平台兼容性有关。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

weex 中使用懒加载之后,打包之后的代码,无法在android中跑起来,出现错误“E/WeexCore: ReportException : Exception: ReferenceError: Can't find variable: window”

打包之后和源码结构

bVbpEtk?w=243&h=185

bVbpEtv###

index.vue

import common from '../extend/native/common.vue'

module.exports = {

props:{

},

data: function () {

return {

tabName:"home"

}

},

components: {

'tab-bar': ()=>import('../components/Tabbar.vue'),

"home": ()=>import('./home.vue'),

"center": ()=>import ('./center.vue'),

"cart": ()=>import('./cart.vue'),

"new-page": ()=>import( './NewPage.vue')

},

computed: {

currentTabComponent: function () {

return this.tabName;

}

},

created: function() {

},

methods: {

detail:function(){

this.$router && this.$router.push("/detail");

},

onTabTo(result){

console.log(result);

this.tabName=result.labelName;

}

}

}

webpack 打包之后的,还有几个文件

// { "framework": "Vue"}

/******/ (function(modules) { // webpackBootstrap

/******/ // install a JSONP callback for chunk loading

/******/ var parentJsonpFunction = window["webpackJsonp"];

/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {

/******/ // add "moreModules" to the modules object,

/******/ // then flag all "chunkIds" as loaded and fire callback

/******/ var moduleId, chunkId, i = 0, resolves = [], result;

/******/ for(;i < chunkIds.length; i++) {

/******/ chunkId = chunkIds[i];

/******/ if(installedChunks[chunkId]) {

/******/ resolves.push(installedChunks[chunkId][0]);

/******/ }

/******/ installedChunks[chunkId] = 0;

/******/ }

/******/ for(moduleId in moreModules) {

/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {

/******/ modules[moduleId] = moreModules[moduleId];

/******/ }

/******/ }

/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);

/******/ while(resolves.length) {

/******/ resolves.shift()();

/******/ }

/******/

/******/ };

/******/

/******/ // The module cache

/******/ var installedModules = {};

/******/

/******/ // objects to store loaded and loading chunks

/******/ var installedChunks = {

/******/ 5: 0

/******/ };

/******/

/******/ // The require function

/******/ function __webpack_require__(moduleId) {

/******/

/******/ // Check if module is in cache

/******/ if(installedModules[moduleId]) {

/******/ return installedModules[moduleId].exports;

/******/ }

/******/ // Create a new module (and put it into the cache)

/******/ var module = installedModules[moduleId] = {

/******/ i: moduleId,

/******/ l: false,

/******/ exports: {}

/******/ };

/******/

/******/ // Execute the module function

/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/

/******/ // Flag the module as loaded

/******/ module.l = true;

/******/

/******/ // Return the exports of the module

/******/ return module.exports;

/******/ }

/******/

/******/ // This file contains only the entry chunk.

/******/ // The chunk loading function for additional chunks

/******/ __webpack_require__.e = function requireEnsure(chunkId) {

/******/ var installedChunkData = installedChunks[chunkId];

/******/ if(installedChunkData === 0) {

/******/ return new Promise(function(resolve) { resolve(); });

/******/ }

/******/

/******/ // a Promise means "currently loading".

/******/ if(installedChunkData) {

/******/ return installedChunkData[2];

/******/ }

/******/

/******/ // setup Promise in chunk cache

/******/ var promise = new Promise(function(resolve, reject) {

/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];

/******/ });

/******/ installedChunkData[2] = promise;

/******/

/******/ // start chunk loading

/******/ var head = document.getElementsByTagName('head')[0];

/******/ var script = document.createElement('script');

/******/ script.type = 'text/javascript';

/******/ script.charset = 'utf-8';

/******/ script.async = true;

/******/ script.timeout = 120000;

/******/

/******/ if (__webpack_require__.nc) {

/******/ script.setAttribute("nonce", __webpack_require__.nc);

/******/ }

/******/ script.src = __webpack_require__.p + "" + chunkId + ".js";

/******/ var timeout = setTimeout(onScriptComplete, 120000);

/******/ script.onerror = script.onload = onScriptComplete;

/******/ function onScriptComplete() {

/******/ // avoid mem leaks in IE.

/******/ script.onerror = script.onload = null;

/******/ clearTimeout(timeout);

/******/ var chunk = installedChunks[chunkId];

/******/ if(chunk !== 0) {

/******/ if(chunk) {

/******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));

/******/ }

/******/ installedChunks[chunkId] = undefined;

/******/ }

/******/ };

/******/ head.appendChild(script);

/******/

/******/ return promise;

/******/ };

/******/

/******/ // expose the modules object (__webpack_modules__)

/******/ __webpack_require__.m = modules;

/******/

/******/ // expose the module cache

/******/ __webpack_require__.c = installedModules;

/******/

/******/ // identity function for calling harmony imports with the correct context

/******/ __webpack_require__.i = function(value) { return value; };

/******/

/******/ // define getter function for harmony exports

/******/ __webpack_require__.d = function(exports, name, getter) {

/******/ if(!__webpack_require__.o(exports, name)) {

/******/ Object.defineProperty(exports, name, {

/******/ configurable: false,

/******/ enumerable: true,

/******/ get: getter

/******/ });

/******/ }

/******/ };

/******/

/******/ // getDefaultExport function for compatibility with non-harmony modules

/******/ __webpack_require__.n = function(module) {

/******/ var getter = module && module.__esModule ?

/******/ function getDefault() { return module['default']; } :

/******/ function getModuleExports() { return module; };

/******/ __webpack_require__.d(getter, 'a', getter);

/******/ return getter;

/******/ };

/******/

/******/ // Object.prototype.hasOwnProperty.call

/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };

/******/

/******/ // __webpack_public_path__

/******/ __webpack_require__.p = "";

/******/

/******/ // on error function for async loading

/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };

/******/

/******/ // Load entry module and return exports

/******/ return __webpack_require__(__webpack_require__.s = 33);

/******/ })

/************************************************************************/

/******/ ({

/***/ 16:

/***/ (function(module, exports, __webpack_require__) {

"use strict";

var _common = __webpack_require__(27);

var _common2 = _interopRequireDefault(_common);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

module.exports = {

props: {},

data: function data() {

return {

tabName: "home"

};

},

components: {

'tab-bar': function tabBar() {

return __webpack_require__.e/* import() */(4).then(__webpack_require__.bind(null, 37));

},

"home": function home() {

return __webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, 41));

},

"center": function center() {

return __webpack_require__.e/* import() */(1).then(__webpack_require__.bind(null, 40));

},

"cart": function cart() {

return __webpack_require__.e/* import() */(2).then(__webpack_require__.bind(null, 39));

},

"new-page": function newPage() {

return __webpack_require__.e/* import() */(3).then(__webpack_require__.bind(null, 38));

}

},

computed: {

currentTabComponent: function currentTabComponent() {

return this.tabName;

}

},

created: function created() {},

methods: {

detail: function detail() {

this.$router && this.$router.push("/detail");

},

onTabTo: function onTabTo(result) {

console.log(result);

this.tabName = result.labelName;

}

}

}; //

//

//

//

//

//

//

/***/ }),

/***/ 21:

/***/ (function(module, exports) {

module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;

return _c('div', [_c(_vm.currentTabComponent, {

tag: "component"

}), _c('tab-bar', {

on: {

"switchPage": _vm.onTabTo

}

})], 1)

},staticRenderFns: []}

module.exports.render._withStripped = true

/***/ }),

/***/ 23:

/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**

* weex-evnt-vue-router v0.0.4

* (c) 2018 fushun

* link https://github.com/dongnaebi/weex-vue-router

* @license Apache-2.0

*/

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var index$1 = Array.isArray || function (arr) {

return Object.prototype.toString.call(arr) == '[object Array]';

};

var isarray = index$1;

/**

* Expose `pathToRegexp`.

*/

var index = pathToRegexp;

var parse_1 = parse;

var compile_1 = compile;

var tokensToFunction_1 = tokensToFunction;

var tokensToRegExp_1 = tokensToRegExp;

/**

* The main path matching regexp utility.

*

* @type {RegExp}

*/

var PATH_REGEXP = new RegExp([

// Match escaped characters that would otherwise appear in future matches.

// This allows the user to escape special characters that won't transform.

'(\\\\.)',

// Match Express-style parameters and un-named parameters with a prefix

// and optional suffixes. Matches appear as:

//

// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]

// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]

// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]

'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');

/**

* Parse a string for the raw tokens.

*

* @param {string} str

* @param {Object=} options

* @return {!Array}

*/

function parse(str, options) {

var tokens = [];

var key = 0;

var index = 0;

var path = '';

var defaultDelimiter = options && options.delimiter || '/';

var res;

while ((res = PATH_REGEXP.exec(str)) != null) {

var m = res[0];

var escaped = res[1];

var offset = res.index;

path += str.slice(index, offset);

index = offset + m.length;

// Ignore already escaped sequences.

if (escaped) {

path += escaped[1];

continue;

}

var next = str[index];

var prefix = res[2];

var name = res[3];

var capture = res[4];

var group = res[5];

var modifier = res[6];

var asterisk = res[7];

// Push the current path onto the tokens.

if (path) {

tokens.push(path);

path = '';

}

var partial = prefix != null && next != null && next !== prefix;

var repeat = modifier === '+' || modifier === '*';

var optional = modifier === '?' || modifier === '*';

var delimiter = res[2] || defaultDelimiter;

var pattern = capture || group;

tokens.push({

name: name || key++,

prefix: prefix || '',

delimiter: delimiter,

optional: optional,

repeat: repeat,

partial: partial,

asterisk: !!asterisk,

pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'

});

}

// Match any characters still remaining.

if (index < str.length) {

path += str.substr(index);

}

// If the path exists, push it onto the end.

if (path) {

tokens.push(path);

}

return tokens;

}

/**

* Compile a string to a template function for the path.

*

* @param {string} str

* @param {Object=} options

* @return {!function(Object=, Object=)}

*/

function compile(str, options) {

return tokensToFunction(parse(str, options));

}

/**

* Prettier encoding of URI path segments.

*

* @param {string}

* @return {string}

*/

function encodeURIComponentPretty(str) {

return encodeURI(str).replace(/[\/?#]/g, function (c) {

return '%' + c.charCodeAt(0).toString(16).toUpperCase();

});

}

/**

* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.

*

* @param {string}

* @return {string}

*/

function encodeAsterisk(str) {

return encodeURI(str).replace(/[?#]/g, function (c) {

return '%' + c.charCodeAt(0).toString(16).toUpperCase();

});

}

/**

* Expose a method for transforming tokens into the path function.

*/

function tokensToFunction(tokens) {

// Compile all the tokens into regexps.

var matches = new Array(tokens.length);

// Compile all the patterns before compilation.

for (var i = 0; i < tokens.length; i++) {

if (_typeof(tokens[i]) === 'object') {

matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');

}

}

return function (obj, opts) {

var path = '';

var data = obj || {};

var options = opts || {};

var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;

for (var i = 0; i < tokens.length; i++) {

var token = tokens[i];

if (typeof token === 'string') {

path += token;

continue;

}

var value = data[token.name];

var segment;

if (value == null) {

if (token.optional) {

// Prepend partial segment prefixes.

if (token.partial) {

path += token.prefix;

}

continue;

} else {

throw new TypeError('Expected "' + token.name + '" to be defined');

}

}

if (isarray(value)) {

if (!token.repeat) {

throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`');

}

if (value.length === 0) {

if (token.optional) {

continue;

} else {

throw new TypeError('Expected "' + token.name + '" to not be empty');

}

}

for (var j = 0; j < value.length; j++) {

segment = encode(value[j]);

if (!matches[i].test(segment)) {

throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`');

}

path += (j === 0 ? token.prefix : token.delimiter) + segment;

}

continue;

}

segment = token.asterisk ? encodeAsterisk(value) : encode(value);

if (!matches[i].test(segment)) {

throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"');

}

path += token.prefix + segment;

}

return path;

};

}

/**

* Escape a regular expression string.

*

* @param {string} str

* @return {string}

*/

function escapeString(str) {

return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');

}

/**

* Escape the capturing group by escaping special characters and meaning.

*

* @param {string} group

* @return {string}

*/

function escapeGroup(group) {

return group.replace(/([=!:$\/()])/g, '\\$1');

}

/**

* Attach the keys as a property of the regexp.

*

* @param {!RegExp} re

* @param {Array} keys

* @return {!RegExp}

*/

function attachKeys(re, keys) {

re.keys = keys;

return re;

}

/**

* Get the flags for a regexp from the options.

*

* @param {Object} options

* @return {string}

*/

function flags(options) {

return options.sensitive ? '' : 'i';

}

/**

* Pull out keys from a regexp.

*

* @param {!RegExp} path

* @param {!Array} keys

* @return {!RegExp}

*/

function regexpToRegexp(path, keys) {

// Use a negative lookahead to match only capturing groups.

var groups = path.source.match(/\((?!\?)/g);

if (groups) {

for (var i = 0; i < groups.length; i++) {

keys.push({

name: i,

prefix: null,

delimiter: null,

optional: false,

repeat: false,

partial: false,

asterisk: false,

pattern: null

});

}

}

return attachKeys(path, keys);

}

/**

* Transform an array into a regexp.

*

* @param {!Array} path

* @param {Array} keys

* @param {!Object} options

* @return {!RegExp}

*/

function arrayToRegexp(path, keys, options) {

var parts = [];

for (var i = 0; i < path.length; i++) {

parts.push(pathToRegexp(path[i], keys, options).source);

}

var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));

return attachKeys(regexp, keys);

}

/**

* Create a path regexp from string input.

*

* @param {string} path

* @param {!Array} keys

* @param {!Object} options

* @return {!RegExp}

*/

function stringToRegexp(path, keys, options) {

return tokensToRegExp(parse(path, options), keys, options);

}

/**

* Expose a function for taking tokens and returning a RegExp.

*

* @param {!Array} tokens

* @param {(Array|Object)=} keys

* @param {Object=} options

* @return {!RegExp}

*/

function tokensToRegExp(tokens, keys, options) {

if (!isarray(keys)) {

options = /** @type {!Object} */keys || options;

keys = [];

}

options = options || {};

var strict = options.strict;

var end = options.end !== false;

var route = '';

// Iterate over the tokens and create our regexp string.

for (var i = 0; i < tokens.length; i++) {

var token = tokens[i];

if (typeof token === 'string') {

route += escapeString(token);

} else {

var prefix = escapeString(token.prefix);

var capture = '(?:' + token.pattern + ')';

keys.push(token);

if (token.repeat) {

capture += '(?:' + prefix + capture + ')*';

}

if (token.optional) {

if (!token.partial) {

capture = '(?:' + prefix + '(' + capture + '))?';

} else {

capture = prefix + '(' + capture + ')?';

}

} else {

capture = prefix + '(' + capture + ')';

}

route += capture;

}

}

var delimiter = escapeString(options.delimiter || '/');

var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;

// In non-strict mode we allow a slash at the end of match. If the path to

// match already ends with a slash, we remove it for consistency. The slash

// is valid at the end of a path match, not in the middle. This is important

// in non-ending mode, where "/test/" shouldn't match "/test//route".

if (!strict) {

route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';

}

if (end) {

route += '$';

} else {

// In non-ending mode, we need the capturing groups to match as much as

// possible by using a positive lookahead to the end or next path segment.

route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';

}

return attachKeys(new RegExp('^' + route, flags(options)), keys);

}

/**

* Normalize the given path string, returning a regular expression.

*

* An empty array can be passed in for the keys, which will hold the

* placeholder key descriptions. For example, using `/user/:id`, `keys` will

* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.

*

* @param {(string|RegExp|Array)} path

* @param {(Array|Object)=} keys

* @param {Object=} options

* @return {!RegExp}

*/

function pathToRegexp(path, keys, options) {

if (!isarray(keys)) {

options = /** @type {!Object} */keys || options;

keys = [];

}

options = options || {};

if (path instanceof RegExp) {

return regexpToRegexp(path, /** @type {!Array} */keys);

}

if (isarray(path)) {

return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options);

}

return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options);

}

index.parse = parse_1;

index.compile = compile_1;

index.tokensToFunction = tokensToFunction_1;

index.tokensToRegExp = tokensToRegExp_1;

/**

* Created by ebi on 2017/2/14.

*/

var weexVueRouter = {

install: function install(Vue, ref) {

var routes = ref.routes;

var weex = ref.weex;

var platform = weex.config.env ? weex.config.env.platform : weex.config.platform;

if (platform.toLowerCase() == 'web') {

return;

}

var event = weex.requireModule('event');

var bundleUrl = weex.config.bundleUrl;

var route = bundleToPath(bundleUrl, routes);

Object.defineProperty(Vue.prototype, "$router", {

value: {

push: function push(url) {

var bundle = pathToBundle(url, routes);

if (event) {

if (!("file://".startsWith(bundle) || "http://".startsWith(bundle) || "https".startsWith(bundle))) {

//默认采用文件的方式

bundle = "file://" + bundle;

}

console.log(bundle);

event.push({

'url': bundle,

'animated': 'true'

}, function () {

console.log('skip complete');

});

}

},

back: function back() {

if (event) {

event.pop();

}

}

},

configurable: false

});

Object.defineProperty(Vue.prototype, '$route', {

configurable: false,

value: {

path: route.path,

params: route.params,

query: route.query,

hash: route.hash,

fullPath: route.fullPath,

matched: route.matched,

name: route.name

}

});

}

};

function pathToBundle(url, routes) {

/* url='/list/2-1?from=1#2'

* r={path:'/list/:cid-:id',bundle:'/product/list.js'}

* */

if (url.indexOf('/') != 0) {

console.error("the url must begin with '/'");

return '';

}

//copy from vue-router

var encodeReserveRE = /[!'()*]/g;

var encodeReserveReplacer = function encodeReserveReplacer(c) {

return '%' + c.charCodeAt(0).toString(16);

};

var encode = function encode(str) {

return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(/%2C/g, ',');

};

/*find out the rule*/

var matchRule = {};

routes.forEach(function (r) {

var re = index(r.path);

var match = re.exec(url);

if (match != null) {

matchRule = r;

}

});

/*get the key and value*/

var keys = [];

var pathReg = index(matchRule.path, keys);

var values = pathReg.exec(url);

var lastValue = values[values.length - 1]; //save the last value to find query and hash

values[values.length - 1] = lastValue.split(/\?|\#/)[0]; //the true value

/*parse params to key/value object*/

var params = {};

if (keys.length > 0) {

keys.forEach(function (key, i) {

params[key.name] = values[i + 1];

});

}

/*get query and hash*/

var queryIndex = lastValue.indexOf('?');

var hashIndex = lastValue.indexOf('#');

if (queryIndex > 0 && hashIndex > 0 && queryIndex > hashIndex) {

console.error("Could not set '#' behind '?'");

return '';

}

var queryStr = queryIndex > 0 ? lastValue.substring(queryIndex + 1, hashIndex > 0 ? hashIndex : lastValue.length) : "";

var hashStr = hashIndex > 0 ? lastValue.substring(hashIndex, lastValue.length) : "";

var query = getParams(queryStr); //{from:1}

/*add the bundleUrl's params and hash*/

var componentPath = matchRule.component;

for (var k in params) {

componentPath += (componentPath.indexOf('?') > 0 ? '&' : '?') + k + '=' + encode(params[k]);

}

for (var q in query) {

componentPath += (componentPath.indexOf('?') > 0 ? '&' : '?') + q + '=' + encode(query[q]);

}

componentPath += hashStr;

return componentPath;

}

function bundleToPath(url, routes) {

//url='domain/product/list.js?cid=2&id=1&from=1'

//matchRule={path:'/list/:cid-:id',component:'domain/product/list.js'}

var route = {

params: null,

query: null,

hash: null,

path: null,

fullPath: null,

matched: null,

name: null

};

var jsBundle = url.split(/\?|\#/)[0];

/*find out the rule*/

var matchRule = null;

routes.forEach(function (r) {

r.component == jsBundle && (matchRule = r);

//http://192.168.253.124:8080/dist/product/list.js

});

if (!matchRule) {

console.error("your component must be like '" + jsBundle + "',can not find it in routes,please check up");

return route;

}

/*use pathToRegexp*/

var keys = [];

index(matchRule.path, keys);

/*get query and hash*/

var queryIndex = url.indexOf('?');

var hashIndex = url.indexOf('#');

var queryStr = queryIndex > 0 ? url.substring(queryIndex + 1, hashIndex > 0 ? hashIndex : url.length) : "";

route.hash = hashIndex > 0 ? url.substring(hashIndex, url.length) : "";

var allQuery = getParams(queryStr); //{cid:2,id:1,from:1}

var params = {},

//{cid:2,id:1}

query = {},

//{from:1}

paramsKey = []; //['cid','id']

if (keys.length > 0) {

paramsKey = keys.map(function (key) {

return key.name;

});

}

for (var q in allQuery) {

allQuery[q] = decodeURIComponent(allQuery[q]);

paramsKey.indexOf(q) < 0 ? query[q] = allQuery[q] : params[q] = allQuery[q];

}

route.params = params;

route.query = query;

//path and fullPath

var path = matchRule.path;

for (var p in params) {

path = path.replace(':' + p, params[p]);

}

route.path = path;

var queryArr = [];

for (var i in query) {

queryArr.push(i + '=' + query[i]);

}

route.fullPath = path + '?' + queryArr.join('&') + route.hash;

route.matched = matchRule;

route.name = matchRule.name;

return route;

}

function getParams(str) {

var temp = {};

if (!str) {

return temp;

}

if (str.indexOf('=') < 0) {

temp[str] = "";

return temp;

}

var arr = str.split('&');

arr.forEach(function (item) {

var w = item.match(/([^=]*)=(.*)/);

temp[w[1]] = w[2];

});

return temp;

}

module.exports = weexVueRouter;

/***/ }),

/***/ 24:

/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", {

value: true

});

/**

* Created by zwwill on 2017/8/27.

*/

var utilFunc = {

initIconFont: function initIconFont() {

var domModule = weex.requireModule('dom');

domModule.addRule('fontFace', {

'fontFamily': "iconfont",

'src': "url('http://at.alicdn.com/t/font_404010_f29c7wlkludz33di.ttf')"

});

},

setBundleUrl: function setBundleUrl(url, jsFile) {

var bundleUrl = url;

var host = '';

var path = '';

var nativeBase = void 0;

var isAndroidAssets = bundleUrl.indexOf('your_current_IP') >= 0 || 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 matches = /\/\/([^\/]+?)\//.exec(bundleUrl);

var matchFirstPath = /\/\/[^\/]+\/([^\/\s]+)\//.exec(bundleUrl);

if (matches && matches.length >= 2) {

host = matches[1];

}

if (matchFirstPath && matchFirstPath.length >= 2) {

path = matchFirstPath[1];

}

nativeBase = 'http://' + host + '/';

}

var h5Base = './index.html?page=';

// in Native

var base = nativeBase;

if (typeof navigator !== 'undefined' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko')) {

// check if in weexpack project

if (path === 'web' || path === 'dist') {

base = h5Base + '/dist/';

} else {

base = h5Base + '';

}

} else {

base = nativeBase + (!!path ? path + '/' : '');

}

var newUrl = base + jsFile;

return newUrl;

},

getUrlSearch: function getUrlSearch(url, name) {

var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");

var r = url.slice(url.indexOf('?') + 1).match(reg);

if (r != null) {

try {

return decodeURIComponent(r[2]);

} catch (_e) {

return null;

}

}

return null;

}

};

exports.default = utilFunc;

/***/ }),

/***/ 25:

/***/ (function(module, exports, __webpack_require__) {

"use strict";

var _weexEvntVueRouter = __webpack_require__(23);

var _weexEvntVueRouter2 = _interopRequireDefault(_weexEvntVueRouter);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//web端的路由在web-router里定义,在app.js里引用

var basePath = ""; /**

* Created by ebi on 2017/1/23.

*/

var routes = [{ path: '/', component: basePath + 'assets/index.js' }, { path: 'home', component: basePath + 'assets/index.js' }, { path: '/detail', component: basePath + 'assets/views/detail.js' }, { path: '/pay', component: basePath + 'assets/views/pay.js' }];

Vue.use(_weexEvntVueRouter2.default, { routes: routes, weex: weex });

/***/ }),

/***/ 27:

/***/ (function(module, exports, __webpack_require__) {

var __vue_exports__, __vue_options__

var __vue_styles__ = []

/* script */

__vue_exports__ = __webpack_require__(35)

/* template */

var __vue_template__ = __webpack_require__(36)

__vue_options__ = __vue_exports__ = __vue_exports__ || {}

if (

typeof __vue_exports__.default === "object" ||

typeof __vue_exports__.default === "function"

) {

if (Object.keys(__vue_exports__).some(function (key) { return key !== "default" && key !== "__esModule" })) {console.error("named exports are not supported in *.vue files.")}

__vue_options__ = __vue_exports__ = __vue_exports__.default

}

if (typeof __vue_options__ === "function") {

__vue_options__ = __vue_options__.options

}

__vue_options__.__file = "D:\\project\\weex\\chat-js\\src\\extend\\native\\common.vue"

__vue_options__.render = __vue_template__.render

__vue_options__.staticRenderFns = __vue_template__.staticRenderFns

__vue_options__.style = __vue_options__.style || {}

__vue_styles__.forEach(function (module) {

for (var name in module) {

__vue_options__.style[name] = module[name]

}

})

if (typeof __register_static_styles__ === "function") {

__register_static_styles__(__vue_options__._scopeId, __vue_styles__)

}

module.exports = __vue_exports__

/***/ }),

/***/ 33:

/***/ (function(module, exports, __webpack_require__) {

var __vue_exports__, __vue_options__

var __vue_styles__ = []

/* script */

__vue_exports__ = __webpack_require__(16)

/* template */

var __vue_template__ = __webpack_require__(21)

__vue_options__ = __vue_exports__ = __vue_exports__ || {}

if (

typeof __vue_exports__.default === "object" ||

typeof __vue_exports__.default === "function"

) {

if (Object.keys(__vue_exports__).some(function (key) { return key !== "default" && key !== "__esModule" })) {console.error("named exports are not supported in *.vue files.")}

__vue_options__ = __vue_exports__ = __vue_exports__.default

}

if (typeof __vue_options__ === "function") {

__vue_options__ = __vue_options__.options

}

__vue_options__.__file = "D:\\project\\weex\\chat-js\\src\\views\\index.vue"

__vue_options__.render = __vue_template__.render

__vue_options__.staticRenderFns = __vue_template__.staticRenderFns

__vue_options__.style = __vue_options__.style || {}

__vue_styles__.forEach(function (module) {

for (var name in module) {

__vue_options__.style[name] = module[name]

}

})

if (typeof __register_static_styles__ === "function") {

__register_static_styles__(__vue_options__._scopeId, __vue_styles__)

}

module.exports = __vue_exports__

module.exports.el = 'true'

new Vue(module.exports)

/***/ }),

/***/ 35:

/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", {

value: true

});

var _util = __webpack_require__(24);

var _util2 = _interopRequireDefault(_util);

var _nativeRouter = __webpack_require__(25);

var _nativeRouter2 = _interopRequireDefault(_nativeRouter);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//

//

exports.default = {

created: function created() {

_util2.default.initIconFont();

}

};

/***/ }),

/***/ 36:

/***/ (function(module, exports) {

module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;

return _c("div")

},staticRenderFns: []}

module.exports.render._withStripped = true

/***/ })

/******/ });

andorid 错误异常

I/ContentCatcher: Interceptor : Catcher list invalid for com.alibaba.weex@com.alibaba.weex.IndexActivity@234540188

Interceptor : Get featureInfo from config pick_mode

W/weex: Warning :Component tree has not build completely,onActivityCreate can not be call!

D/CLog: Warning :Component tree has not build completely,onActivityCreate can not be call!

E/weex: end getBundleType type:Others time:1

D/CLog: end getBundleType type:Others time:1

D/Update: check for update: 20

D/CLog: Update:check for update: 20

W/weex: Warning :Component tree has not build completely,onActivityStart can not be call!

D/CLog: Warning :Component tree has not build completely,onActivityStart can not be call!

W/weex: Warning :Component tree has not build completely, onActivityResume can not be call!

D/CLog: Warning :Component tree has not build completely, onActivityResume can not be call!

D/NetworkSecurityConfig: No Network Security Config specified, using platform default

E/WeexCore: ReportException : Exception: ReferenceError: Can't find variable: window

(global function):8:43

(global function):154:12

anonymous@(global function):1456:7

(weex framework):1:41792

createInstance@(weex framework):1:41803

(weex framework):1:178788

E/weex: reportJSException >>>> instanceId:1, exception function:createInstance, exception:Exception: ReferenceError: Can't find variable: window

(global function):8:43

(global function):154:12

anonymous@(global function):1456:7

(weex framework):1:41792

createInstance@(weex framework):1:41803

(weex framework):1:178788

D/CLog: reportJSException >>>> instanceId:1, exception function:createInstance, exception:Exception: ReferenceError: Can't find variable: window

(global function):8:43

(global function):154:12

anonymous@(global function):1456:7

(weex framework):1:41792

createInstance@(weex framework):1:41803

(weex framework):1:178788

D/weex: errCode:-9600,function:createInstance,exception:Exception: ReferenceError: Can't find variable: window

(global function):8:43

(global function):154:12

anonymous@(global function):1456:7

(weex framework):1:41792

createInstance@(weex framework):1:41803

(weex framework):1:178788

getTemplateInfo== template md5 e734fd1ae5deb3484e9abafcbd581df0 length 40547 base64 md5 5zT9GuXes0hOmrr8vVgd8A== response header {"templateSourceBase64MD5":["5zT9GuXes0hOmrr8vVgd8A=="],"templateSourceMD5":["e734fd1ae5deb3484e9abafcbd581df0"]}

D/CLog: weex: errCode:-9600,function:createInstance,exception:Exception: ReferenceError: Can't find variable: window

(global function):8:43

(global function):154:12

anonymous@(global function):1456:7

(weex framework):1:41792

createInstance@(weex framework):1:41803

(weex framework):1:178788

getTemplateInfo== template md5 e734fd1ae5deb3484e9abafcbd581df0 length 40547 base64 md5 5zT9GuXes0hOmrr8vVgd8A== response header {"templateSourceBase64MD5":["5zT9GuXes0hOmrr8vVgd8A=="],"templateSourceMD5":["e734fd1ae5deb3484e9abafcbd581df0"]}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值