From 9cffb293a00c53d1041010d9456591b8f5002d67 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 24 Sep 2019 16:46:06 +0800 Subject: [PATCH] fix(h5): disable window.Vue.use(VueRouter) --- .../h5-vue-router/dist/vue-router.common.js | 74 +++++++++---------- .../h5-vue-router/dist/vue-router.esm.js | 74 +++++++++---------- .../packages/h5-vue-router/dist/vue-router.js | 74 +++++++++---------- .../h5-vue-router/dist/vue-router.min.js | 4 +- 4 files changed, 113 insertions(+), 113 deletions(-) mode change 100755 => 100644 packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.common.js mode change 100755 => 100644 packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js mode change 100755 => 100644 packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.js mode change 100755 => 100644 packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.min.js diff --git a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.common.js b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.common.js old mode 100755 new mode 100644 index 64f55896b..b552c428d --- a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.common.js +++ b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.common.js @@ -1,6 +1,6 @@ /*! * vue-router v3.0.1 - * (c) 2018 Evan You + * (c) 2019 Evan You * @license MIT */ 'use strict'; @@ -1671,19 +1671,19 @@ function scrollToPosition (shouldScroll, position) { /* */ -var supportsPushState = inBrowser && (function() { - var ua = window.navigator.userAgent; +var supportsPushState = inBrowser && (function () { + var ua = window.navigator.userAgent; - if ( - (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && + if ( + (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1 - ) { - return false - } + ) { + return false + } - return window.history && 'pushState' in window.history + return window.history && 'pushState' in window.history })(); // use User Timing api (if present) for more accurate key precision @@ -1697,39 +1697,39 @@ function genKey () { return Time.now().toFixed(3) } -function getStateKey() { - return _key +function getStateKey () { + return _key } -function setStateKey(key) { - _key = key; +function setStateKey (key) { + _key = key; } -function pushState(url , id , replace ) { - saveScrollPosition(); - // try...catch the pushState call to get around Safari - // DOM Exception 18 where it limits to 100 pushState calls - var history = window.history; - try { - if (replace) { - history.replaceState({ +function pushState (url , id , replace ) { + saveScrollPosition(); + // try...catch the pushState call to get around Safari + // DOM Exception 18 where it limits to 100 pushState calls + var history = window.history; + try { + if (replace) { + history.replaceState({ id: id, - key: _key - }, '', url); - } else { - _key = genKey(); - history.pushState({ + key: _key + }, '', url); + } else { + _key = genKey(); + history.pushState({ id: id, - key: _key - }, '', url); - } - } catch (e) { - window.location[replace ? 'replace' : 'assign'](url); - } + key: _key + }, '', url); + } + } catch (e) { + window.location[replace ? 'replace' : 'assign'](url); + } } -function replaceState(url , id ) { - pushState(url, id, true); +function replaceState (url , id ) { + pushState(url, id, true); } /* */ @@ -2776,8 +2776,8 @@ function createHref (base, fullPath, mode) { VueRouter.install = install; VueRouter.version = '3.0.1'; -if (inBrowser && window.Vue) { - window.Vue.use(VueRouter); -} +// if (inBrowser && window.Vue) { +// window.Vue.use(VueRouter) +// } module.exports = VueRouter; diff --git a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js old mode 100755 new mode 100644 index 69d47d3bb..19ec64b2a --- a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js +++ b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js @@ -1,6 +1,6 @@ /*! * vue-router v3.0.1 - * (c) 2018 Evan You + * (c) 2019 Evan You * @license MIT */ /* */ @@ -1669,19 +1669,19 @@ function scrollToPosition (shouldScroll, position) { /* */ -var supportsPushState = inBrowser && (function() { - var ua = window.navigator.userAgent; +var supportsPushState = inBrowser && (function () { + var ua = window.navigator.userAgent; - if ( - (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && + if ( + (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1 - ) { - return false - } + ) { + return false + } - return window.history && 'pushState' in window.history + return window.history && 'pushState' in window.history })(); // use User Timing api (if present) for more accurate key precision @@ -1695,39 +1695,39 @@ function genKey () { return Time.now().toFixed(3) } -function getStateKey() { - return _key +function getStateKey () { + return _key } -function setStateKey(key) { - _key = key; +function setStateKey (key) { + _key = key; } -function pushState(url , id , replace ) { - saveScrollPosition(); - // try...catch the pushState call to get around Safari - // DOM Exception 18 where it limits to 100 pushState calls - var history = window.history; - try { - if (replace) { - history.replaceState({ +function pushState (url , id , replace ) { + saveScrollPosition(); + // try...catch the pushState call to get around Safari + // DOM Exception 18 where it limits to 100 pushState calls + var history = window.history; + try { + if (replace) { + history.replaceState({ id: id, - key: _key - }, '', url); - } else { - _key = genKey(); - history.pushState({ + key: _key + }, '', url); + } else { + _key = genKey(); + history.pushState({ id: id, - key: _key - }, '', url); - } - } catch (e) { - window.location[replace ? 'replace' : 'assign'](url); - } + key: _key + }, '', url); + } + } catch (e) { + window.location[replace ? 'replace' : 'assign'](url); + } } -function replaceState(url , id ) { - pushState(url, id, true); +function replaceState (url , id ) { + pushState(url, id, true); } /* */ @@ -2774,8 +2774,8 @@ function createHref (base, fullPath, mode) { VueRouter.install = install; VueRouter.version = '3.0.1'; -if (inBrowser && window.Vue) { - window.Vue.use(VueRouter); -} +// if (inBrowser && window.Vue) { +// window.Vue.use(VueRouter) +// } export default VueRouter; diff --git a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.js b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.js old mode 100755 new mode 100644 index 9b4aa335a..ef0d4d83f --- a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.js +++ b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.js @@ -1,6 +1,6 @@ /*! * vue-router v3.0.1 - * (c) 2018 Evan You + * (c) 2019 Evan You * @license MIT */ (function (global, factory) { @@ -1675,19 +1675,19 @@ function scrollToPosition (shouldScroll, position) { /* */ -var supportsPushState = inBrowser && (function() { - var ua = window.navigator.userAgent; +var supportsPushState = inBrowser && (function () { + var ua = window.navigator.userAgent; - if ( - (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && + if ( + (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1 - ) { - return false - } + ) { + return false + } - return window.history && 'pushState' in window.history + return window.history && 'pushState' in window.history })(); // use User Timing api (if present) for more accurate key precision @@ -1701,39 +1701,39 @@ function genKey () { return Time.now().toFixed(3) } -function getStateKey() { - return _key +function getStateKey () { + return _key } -function setStateKey(key) { - _key = key; +function setStateKey (key) { + _key = key; } -function pushState(url , id , replace ) { - saveScrollPosition(); - // try...catch the pushState call to get around Safari - // DOM Exception 18 where it limits to 100 pushState calls - var history = window.history; - try { - if (replace) { - history.replaceState({ +function pushState (url , id , replace ) { + saveScrollPosition(); + // try...catch the pushState call to get around Safari + // DOM Exception 18 where it limits to 100 pushState calls + var history = window.history; + try { + if (replace) { + history.replaceState({ id: id, - key: _key - }, '', url); - } else { - _key = genKey(); - history.pushState({ + key: _key + }, '', url); + } else { + _key = genKey(); + history.pushState({ id: id, - key: _key - }, '', url); - } - } catch (e) { - window.location[replace ? 'replace' : 'assign'](url); - } + key: _key + }, '', url); + } + } catch (e) { + window.location[replace ? 'replace' : 'assign'](url); + } } -function replaceState(url , id ) { - pushState(url, id, true); +function replaceState (url , id ) { + pushState(url, id, true); } /* */ @@ -2780,9 +2780,9 @@ function createHref (base, fullPath, mode) { VueRouter.install = install; VueRouter.version = '3.0.1'; -if (inBrowser && window.Vue) { - window.Vue.use(VueRouter); -} +// if (inBrowser && window.Vue) { +// window.Vue.use(VueRouter) +// } return VueRouter; diff --git a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.min.js b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.min.js old mode 100755 new mode 100644 index bf146f590..63223428f --- a/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.min.js +++ b/packages/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.min.js @@ -1,6 +1,6 @@ /*! * vue-router v3.0.1 - * (c) 2018 Evan You + * (c) 2019 Evan You * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function l(t){return-1=e.length?n():e[t]?r(e[t],function(){o(t+1)}):o(t+1)};o(0)}function ut(r){return function(t,e,u){var c=!1,p=0,f=null;ct(r,function(r,t,n,o){if("function"==typeof r&&void 0===r.cid){c=!0,p++;var e,i=ht(function(t){var e;((e=t).__esModule||ft&&"Module"===e[Symbol.toStringTag])&&(t=t.default),r.resolved="function"==typeof t?t:d.extend(t),n.components[o]=t,--p<=0&&u()}),a=ht(function(t){var e="Failed to resolve async component "+o+": "+t;f||(f=l(t)?t:new Error(e),u(f))});try{e=r(i,a)}catch(t){a(t)}if(e)if("function"==typeof e.then)e.then(i,a);else{var s=e.component;s&&"function"==typeof s.then&&s.then(i,a)}}}),c||u()}}function ct(t,r){return pt(t.map(function(e){return Object.keys(e.components).map(function(t){return r(e.components[t],e.instances[t],e,t)})}))}function pt(t){return Array.prototype.concat.apply([],t)}var ft="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ht(r){var n=!1;return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(!n)return n=!0,r.apply(this,t)}}var lt=function(t,e){this.router=t,this.base=function(t){if(!t)if(y){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=O,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function dt(t,i,a,e){var r=ct(t,function(t,e,r,n){var o=function(t,e){"function"!=typeof t&&(t=d.extend(t));return t.options[e]}(t,i);if(o)return Array.isArray(o)?o.map(function(t){return a(t,e,r,n)}):a(o,e,r,n)});return pt(e?r.reverse():r)}function yt(t,e){if(e)return function(){return t.apply(e,arguments)}}lt.prototype.listen=function(t){this.cb=t},lt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},lt.prototype.onError=function(t){this.errorCbs.push(t)},lt.prototype.transitionTo=function(t,e,r){var n=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){n.updateRoute(o),e&&e(o),n.ensureURL(),n.ready||(n.ready=!0,n.readyCbs.forEach(function(t){t(o)}))},function(e){r&&r(e),e&&!n.ready&&(n.ready=!0,n.readyErrorCbs.forEach(function(t){t(e)}))})},lt.prototype.confirmTransition=function(r,e,t){var n=this,o=this.current,i=function(e){l(e)&&(n.errorCbs.length?n.errorCbs.forEach(function(t){t(e)}):console.error(e)),t&&t(e)},a=function(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){e.index=r,e.updateRoute(n)})}},t.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},t.prototype.ensureURL=function(){},t}(lt),Et=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=D(t.routes||[],this),this.id=t.id||1,this.minId=t.id||1;var e=t.mode||"hash";switch(this.fallback="history"===e&&!tt&&!1!==t.fallback,this.fallback&&(e="hash"),y||(e="abstract"),this.mode=e){case"history":this.history=new vt(this,t.base);break;case"hash":this.history=new gt(this,t.base,this.fallback);break;case"abstract":this.history=new kt(this,t.base)}},jt={currentRoute:{configurable:!0}};function Ot(e,r){return e.push(r),function(){var t=e.indexOf(r);-1=e.length?n():e[t]?r(e[t],function(){o(t+1)}):o(t+1)};o(0)}function ut(r){return function(t,e,u){var c=!1,p=0,f=null;ct(r,function(r,t,n,o){if("function"==typeof r&&void 0===r.cid){c=!0,p++;var e,i=ht(function(t){var e;((e=t).__esModule||ft&&"Module"===e[Symbol.toStringTag])&&(t=t.default),r.resolved="function"==typeof t?t:d.extend(t),n.components[o]=t,--p<=0&&u()}),a=ht(function(t){var e="Failed to resolve async component "+o+": "+t;f||(f=l(t)?t:new Error(e),u(f))});try{e=r(i,a)}catch(t){a(t)}if(e)if("function"==typeof e.then)e.then(i,a);else{var s=e.component;s&&"function"==typeof s.then&&s.then(i,a)}}}),c||u()}}function ct(t,r){return pt(t.map(function(e){return Object.keys(e.components).map(function(t){return r(e.components[t],e.instances[t],e,t)})}))}function pt(t){return Array.prototype.concat.apply([],t)}var ft="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ht(r){var n=!1;return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(!n)return n=!0,r.apply(this,t)}}var lt=function(t,e){this.router=t,this.base=function(t){if(!t)if(y){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=O,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function dt(t,i,a,e){var r=ct(t,function(t,e,r,n){var o=function(t,e){"function"!=typeof t&&(t=d.extend(t));return t.options[e]}(t,i);if(o)return Array.isArray(o)?o.map(function(t){return a(t,e,r,n)}):a(o,e,r,n)});return pt(e?r.reverse():r)}function yt(t,e){if(e)return function(){return t.apply(e,arguments)}}lt.prototype.listen=function(t){this.cb=t},lt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},lt.prototype.onError=function(t){this.errorCbs.push(t)},lt.prototype.transitionTo=function(t,e,r){var n=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){n.updateRoute(o),e&&e(o),n.ensureURL(),n.ready||(n.ready=!0,n.readyCbs.forEach(function(t){t(o)}))},function(e){r&&r(e),e&&!n.ready&&(n.ready=!0,n.readyErrorCbs.forEach(function(t){t(e)}))})},lt.prototype.confirmTransition=function(r,e,t){var n=this,o=this.current,i=function(e){l(e)&&(n.errorCbs.length?n.errorCbs.forEach(function(t){t(e)}):console.error(e)),t&&t(e)},a=function(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){e.index=r,e.updateRoute(n)})}},t.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},t.prototype.ensureURL=function(){},t}(lt),Et=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=D(t.routes||[],this),this.id=t.id||1,this.minId=t.id||1;var e=t.mode||"hash";switch(this.fallback="history"===e&&!tt&&!1!==t.fallback,this.fallback&&(e="hash"),y||(e="abstract"),this.mode=e){case"history":this.history=new vt(this,t.base);break;case"hash":this.history=new gt(this,t.base,this.fallback);break;case"abstract":this.history=new kt(this,t.base)}},jt={currentRoute:{configurable:!0}};function Ot(e,r){return e.push(r),function(){var t=e.indexOf(r);-1