提交 9cffb293 编写于 作者: fxy060608's avatar fxy060608

fix(h5): disable window.Vue.use(VueRouter)

上级 d296938a
/*! /*!
* vue-router v3.0.1 * vue-router v3.0.1
* (c) 2018 Evan You * (c) 2019 Evan You
* @license MIT * @license MIT
*/ */
'use strict'; 'use strict';
...@@ -1671,19 +1671,19 @@ function scrollToPosition (shouldScroll, position) { ...@@ -1671,19 +1671,19 @@ function scrollToPosition (shouldScroll, position) {
/* */ /* */
var supportsPushState = inBrowser && (function() { var supportsPushState = inBrowser && (function () {
var ua = window.navigator.userAgent; var ua = window.navigator.userAgent;
if ( if (
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Mobile Safari') !== -1 &&
ua.indexOf('Chrome') === -1 && ua.indexOf('Chrome') === -1 &&
ua.indexOf('Windows Phone') === -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 // use User Timing api (if present) for more accurate key precision
...@@ -1697,39 +1697,39 @@ function genKey () { ...@@ -1697,39 +1697,39 @@ function genKey () {
return Time.now().toFixed(3) return Time.now().toFixed(3)
} }
function getStateKey() { function getStateKey () {
return _key return _key
} }
function setStateKey(key) { function setStateKey (key) {
_key = key; _key = key;
} }
function pushState(url , id , replace ) { function pushState (url , id , replace ) {
saveScrollPosition(); saveScrollPosition();
// try...catch the pushState call to get around Safari // try...catch the pushState call to get around Safari
// DOM Exception 18 where it limits to 100 pushState calls // DOM Exception 18 where it limits to 100 pushState calls
var history = window.history; var history = window.history;
try { try {
if (replace) { if (replace) {
history.replaceState({ history.replaceState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} else { } else {
_key = genKey(); _key = genKey();
history.pushState({ history.pushState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} }
} catch (e) { } catch (e) {
window.location[replace ? 'replace' : 'assign'](url); window.location[replace ? 'replace' : 'assign'](url);
} }
} }
function replaceState(url , id ) { function replaceState (url , id ) {
pushState(url, id, true); pushState(url, id, true);
} }
/* */ /* */
...@@ -2776,8 +2776,8 @@ function createHref (base, fullPath, mode) { ...@@ -2776,8 +2776,8 @@ function createHref (base, fullPath, mode) {
VueRouter.install = install; VueRouter.install = install;
VueRouter.version = '3.0.1'; VueRouter.version = '3.0.1';
if (inBrowser && window.Vue) { // if (inBrowser && window.Vue) {
window.Vue.use(VueRouter); // window.Vue.use(VueRouter)
} // }
module.exports = VueRouter; module.exports = VueRouter;
/*! /*!
* vue-router v3.0.1 * vue-router v3.0.1
* (c) 2018 Evan You * (c) 2019 Evan You
* @license MIT * @license MIT
*/ */
/* */ /* */
...@@ -1669,19 +1669,19 @@ function scrollToPosition (shouldScroll, position) { ...@@ -1669,19 +1669,19 @@ function scrollToPosition (shouldScroll, position) {
/* */ /* */
var supportsPushState = inBrowser && (function() { var supportsPushState = inBrowser && (function () {
var ua = window.navigator.userAgent; var ua = window.navigator.userAgent;
if ( if (
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Mobile Safari') !== -1 &&
ua.indexOf('Chrome') === -1 && ua.indexOf('Chrome') === -1 &&
ua.indexOf('Windows Phone') === -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 // use User Timing api (if present) for more accurate key precision
...@@ -1695,39 +1695,39 @@ function genKey () { ...@@ -1695,39 +1695,39 @@ function genKey () {
return Time.now().toFixed(3) return Time.now().toFixed(3)
} }
function getStateKey() { function getStateKey () {
return _key return _key
} }
function setStateKey(key) { function setStateKey (key) {
_key = key; _key = key;
} }
function pushState(url , id , replace ) { function pushState (url , id , replace ) {
saveScrollPosition(); saveScrollPosition();
// try...catch the pushState call to get around Safari // try...catch the pushState call to get around Safari
// DOM Exception 18 where it limits to 100 pushState calls // DOM Exception 18 where it limits to 100 pushState calls
var history = window.history; var history = window.history;
try { try {
if (replace) { if (replace) {
history.replaceState({ history.replaceState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} else { } else {
_key = genKey(); _key = genKey();
history.pushState({ history.pushState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} }
} catch (e) { } catch (e) {
window.location[replace ? 'replace' : 'assign'](url); window.location[replace ? 'replace' : 'assign'](url);
} }
} }
function replaceState(url , id ) { function replaceState (url , id ) {
pushState(url, id, true); pushState(url, id, true);
} }
/* */ /* */
...@@ -2774,8 +2774,8 @@ function createHref (base, fullPath, mode) { ...@@ -2774,8 +2774,8 @@ function createHref (base, fullPath, mode) {
VueRouter.install = install; VueRouter.install = install;
VueRouter.version = '3.0.1'; VueRouter.version = '3.0.1';
if (inBrowser && window.Vue) { // if (inBrowser && window.Vue) {
window.Vue.use(VueRouter); // window.Vue.use(VueRouter)
} // }
export default VueRouter; export default VueRouter;
/*! /*!
* vue-router v3.0.1 * vue-router v3.0.1
* (c) 2018 Evan You * (c) 2019 Evan You
* @license MIT * @license MIT
*/ */
(function (global, factory) { (function (global, factory) {
...@@ -1675,19 +1675,19 @@ function scrollToPosition (shouldScroll, position) { ...@@ -1675,19 +1675,19 @@ function scrollToPosition (shouldScroll, position) {
/* */ /* */
var supportsPushState = inBrowser && (function() { var supportsPushState = inBrowser && (function () {
var ua = window.navigator.userAgent; var ua = window.navigator.userAgent;
if ( if (
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Mobile Safari') !== -1 &&
ua.indexOf('Chrome') === -1 && ua.indexOf('Chrome') === -1 &&
ua.indexOf('Windows Phone') === -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 // use User Timing api (if present) for more accurate key precision
...@@ -1701,39 +1701,39 @@ function genKey () { ...@@ -1701,39 +1701,39 @@ function genKey () {
return Time.now().toFixed(3) return Time.now().toFixed(3)
} }
function getStateKey() { function getStateKey () {
return _key return _key
} }
function setStateKey(key) { function setStateKey (key) {
_key = key; _key = key;
} }
function pushState(url , id , replace ) { function pushState (url , id , replace ) {
saveScrollPosition(); saveScrollPosition();
// try...catch the pushState call to get around Safari // try...catch the pushState call to get around Safari
// DOM Exception 18 where it limits to 100 pushState calls // DOM Exception 18 where it limits to 100 pushState calls
var history = window.history; var history = window.history;
try { try {
if (replace) { if (replace) {
history.replaceState({ history.replaceState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} else { } else {
_key = genKey(); _key = genKey();
history.pushState({ history.pushState({
id: id, id: id,
key: _key key: _key
}, '', url); }, '', url);
} }
} catch (e) { } catch (e) {
window.location[replace ? 'replace' : 'assign'](url); window.location[replace ? 'replace' : 'assign'](url);
} }
} }
function replaceState(url , id ) { function replaceState (url , id ) {
pushState(url, id, true); pushState(url, id, true);
} }
/* */ /* */
...@@ -2780,9 +2780,9 @@ function createHref (base, fullPath, mode) { ...@@ -2780,9 +2780,9 @@ function createHref (base, fullPath, mode) {
VueRouter.install = install; VueRouter.install = install;
VueRouter.version = '3.0.1'; VueRouter.version = '3.0.1';
if (inBrowser && window.Vue) { // if (inBrowser && window.Vue) {
window.Vue.use(VueRouter); // window.Vue.use(VueRouter)
} // }
return VueRouter; return VueRouter;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册