Skip to content

Commit 9828c1e

Browse files
committed
build: bundle 3.1.5
1 parent 0fb1343 commit 9828c1e

6 files changed

+212
-112
lines changed

Diff for: dist/vue-router.common.js

+52-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-router v3.1.4
2+
* vue-router v3.1.5
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -68,32 +68,45 @@ var View = {
6868
var depth = 0;
6969
var inactive = false;
7070
while (parent && parent._routerRoot !== parent) {
71-
var vnodeData = parent.$vnode && parent.$vnode.data;
72-
if (vnodeData) {
73-
if (vnodeData.routerView) {
74-
depth++;
75-
}
76-
if (vnodeData.keepAlive && parent._inactive) {
77-
inactive = true;
78-
}
71+
var vnodeData = parent.$vnode ? parent.$vnode.data : {};
72+
if (vnodeData.routerView) {
73+
depth++;
74+
}
75+
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
76+
inactive = true;
7977
}
8078
parent = parent.$parent;
8179
}
8280
data.routerViewDepth = depth;
8381

8482
// render previous view if the tree is inactive and kept-alive
8583
if (inactive) {
86-
return h(cache[name], data, children)
84+
var cachedData = cache[name];
85+
var cachedComponent = cachedData && cachedData.component;
86+
if (cachedComponent) {
87+
// #2301
88+
// pass props
89+
if (cachedData.configProps) {
90+
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
91+
}
92+
return h(cachedComponent, data, children)
93+
} else {
94+
// render previous empty view
95+
return h()
96+
}
8797
}
8898

8999
var matched = route.matched[depth];
90-
// render empty node if no matched route
91-
if (!matched) {
100+
var component = matched && matched.components[name];
101+
102+
// render empty node if no matched route or no config component
103+
if (!matched || !component) {
92104
cache[name] = null;
93105
return h()
94106
}
95107

96-
var component = cache[name] = matched.components[name];
108+
// cache component
109+
cache[name] = { component: component };
97110

98111
// attach instance registration hook
99112
// this will be called in the instance's injected lifecycle hooks
@@ -125,25 +138,37 @@ var View = {
125138
}
126139
};
127140

128-
// resolve props
129-
var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
130-
if (propsToPass) {
131-
// clone to prevent mutation
132-
propsToPass = data.props = extend({}, propsToPass);
133-
// pass non-declared props as attrs
134-
var attrs = data.attrs = data.attrs || {};
135-
for (var key in propsToPass) {
136-
if (!component.props || !(key in component.props)) {
137-
attrs[key] = propsToPass[key];
138-
delete propsToPass[key];
139-
}
140-
}
141+
var configProps = matched.props && matched.props[name];
142+
// save route and configProps in cachce
143+
if (configProps) {
144+
extend(cache[name], {
145+
route: route,
146+
configProps: configProps
147+
});
148+
fillPropsinData(component, data, route, configProps);
141149
}
142150

143151
return h(component, data, children)
144152
}
145153
};
146154

155+
function fillPropsinData (component, data, route, configProps) {
156+
// resolve props
157+
var propsToPass = data.props = resolveProps(route, configProps);
158+
if (propsToPass) {
159+
// clone to prevent mutation
160+
propsToPass = data.props = extend({}, propsToPass);
161+
// pass non-declared props as attrs
162+
var attrs = data.attrs = data.attrs || {};
163+
for (var key in propsToPass) {
164+
if (!component.props || !(key in component.props)) {
165+
attrs[key] = propsToPass[key];
166+
delete propsToPass[key];
167+
}
168+
}
169+
}
170+
}
171+
147172
function resolveProps (route, config) {
148173
switch (typeof config) {
149174
case 'undefined':
@@ -2882,7 +2907,7 @@ function createHref (base, fullPath, mode) {
28822907
}
28832908

28842909
VueRouter.install = install;
2885-
VueRouter.version = '3.1.4';
2910+
VueRouter.version = '3.1.5';
28862911

28872912
if (inBrowser && window.Vue) {
28882913
window.Vue.use(VueRouter);

Diff for: dist/vue-router.esm.browser.js

+52-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-router v3.1.4
2+
* vue-router v3.1.5
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -61,32 +61,45 @@ var View = {
6161
let depth = 0;
6262
let inactive = false;
6363
while (parent && parent._routerRoot !== parent) {
64-
const vnodeData = parent.$vnode && parent.$vnode.data;
65-
if (vnodeData) {
66-
if (vnodeData.routerView) {
67-
depth++;
68-
}
69-
if (vnodeData.keepAlive && parent._inactive) {
70-
inactive = true;
71-
}
64+
const vnodeData = parent.$vnode ? parent.$vnode.data : {};
65+
if (vnodeData.routerView) {
66+
depth++;
67+
}
68+
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
69+
inactive = true;
7270
}
7371
parent = parent.$parent;
7472
}
7573
data.routerViewDepth = depth;
7674

7775
// render previous view if the tree is inactive and kept-alive
7876
if (inactive) {
79-
return h(cache[name], data, children)
77+
const cachedData = cache[name];
78+
const cachedComponent = cachedData && cachedData.component;
79+
if (cachedComponent) {
80+
// #2301
81+
// pass props
82+
if (cachedData.configProps) {
83+
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
84+
}
85+
return h(cachedComponent, data, children)
86+
} else {
87+
// render previous empty view
88+
return h()
89+
}
8090
}
8191

8292
const matched = route.matched[depth];
83-
// render empty node if no matched route
84-
if (!matched) {
93+
const component = matched && matched.components[name];
94+
95+
// render empty node if no matched route or no config component
96+
if (!matched || !component) {
8597
cache[name] = null;
8698
return h()
8799
}
88100

89-
const component = cache[name] = matched.components[name];
101+
// cache component
102+
cache[name] = { component };
90103

91104
// attach instance registration hook
92105
// this will be called in the instance's injected lifecycle hooks
@@ -118,25 +131,37 @@ var View = {
118131
}
119132
};
120133

121-
// resolve props
122-
let propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
123-
if (propsToPass) {
124-
// clone to prevent mutation
125-
propsToPass = data.props = extend({}, propsToPass);
126-
// pass non-declared props as attrs
127-
const attrs = data.attrs = data.attrs || {};
128-
for (const key in propsToPass) {
129-
if (!component.props || !(key in component.props)) {
130-
attrs[key] = propsToPass[key];
131-
delete propsToPass[key];
132-
}
133-
}
134+
const configProps = matched.props && matched.props[name];
135+
// save route and configProps in cachce
136+
if (configProps) {
137+
extend(cache[name], {
138+
route,
139+
configProps
140+
});
141+
fillPropsinData(component, data, route, configProps);
134142
}
135143

136144
return h(component, data, children)
137145
}
138146
};
139147

148+
function fillPropsinData (component, data, route, configProps) {
149+
// resolve props
150+
let propsToPass = data.props = resolveProps(route, configProps);
151+
if (propsToPass) {
152+
// clone to prevent mutation
153+
propsToPass = data.props = extend({}, propsToPass);
154+
// pass non-declared props as attrs
155+
const attrs = data.attrs = data.attrs || {};
156+
for (const key in propsToPass) {
157+
if (!component.props || !(key in component.props)) {
158+
attrs[key] = propsToPass[key];
159+
delete propsToPass[key];
160+
}
161+
}
162+
}
163+
}
164+
140165
function resolveProps (route, config) {
141166
switch (typeof config) {
142167
case 'undefined':
@@ -2832,7 +2857,7 @@ function createHref (base, fullPath, mode) {
28322857
}
28332858

28342859
VueRouter.install = install;
2835-
VueRouter.version = '3.1.4';
2860+
VueRouter.version = '3.1.5';
28362861

28372862
if (inBrowser && window.Vue) {
28382863
window.Vue.use(VueRouter);

Diff for: dist/vue-router.esm.browser.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/vue-router.esm.js

+52-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-router v3.1.4
2+
* vue-router v3.1.5
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -66,32 +66,45 @@ var View = {
6666
var depth = 0;
6767
var inactive = false;
6868
while (parent && parent._routerRoot !== parent) {
69-
var vnodeData = parent.$vnode && parent.$vnode.data;
70-
if (vnodeData) {
71-
if (vnodeData.routerView) {
72-
depth++;
73-
}
74-
if (vnodeData.keepAlive && parent._inactive) {
75-
inactive = true;
76-
}
69+
var vnodeData = parent.$vnode ? parent.$vnode.data : {};
70+
if (vnodeData.routerView) {
71+
depth++;
72+
}
73+
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
74+
inactive = true;
7775
}
7876
parent = parent.$parent;
7977
}
8078
data.routerViewDepth = depth;
8179

8280
// render previous view if the tree is inactive and kept-alive
8381
if (inactive) {
84-
return h(cache[name], data, children)
82+
var cachedData = cache[name];
83+
var cachedComponent = cachedData && cachedData.component;
84+
if (cachedComponent) {
85+
// #2301
86+
// pass props
87+
if (cachedData.configProps) {
88+
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
89+
}
90+
return h(cachedComponent, data, children)
91+
} else {
92+
// render previous empty view
93+
return h()
94+
}
8595
}
8696

8797
var matched = route.matched[depth];
88-
// render empty node if no matched route
89-
if (!matched) {
98+
var component = matched && matched.components[name];
99+
100+
// render empty node if no matched route or no config component
101+
if (!matched || !component) {
90102
cache[name] = null;
91103
return h()
92104
}
93105

94-
var component = cache[name] = matched.components[name];
106+
// cache component
107+
cache[name] = { component: component };
95108

96109
// attach instance registration hook
97110
// this will be called in the instance's injected lifecycle hooks
@@ -123,25 +136,37 @@ var View = {
123136
}
124137
};
125138

126-
// resolve props
127-
var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
128-
if (propsToPass) {
129-
// clone to prevent mutation
130-
propsToPass = data.props = extend({}, propsToPass);
131-
// pass non-declared props as attrs
132-
var attrs = data.attrs = data.attrs || {};
133-
for (var key in propsToPass) {
134-
if (!component.props || !(key in component.props)) {
135-
attrs[key] = propsToPass[key];
136-
delete propsToPass[key];
137-
}
138-
}
139+
var configProps = matched.props && matched.props[name];
140+
// save route and configProps in cachce
141+
if (configProps) {
142+
extend(cache[name], {
143+
route: route,
144+
configProps: configProps
145+
});
146+
fillPropsinData(component, data, route, configProps);
139147
}
140148

141149
return h(component, data, children)
142150
}
143151
};
144152

153+
function fillPropsinData (component, data, route, configProps) {
154+
// resolve props
155+
var propsToPass = data.props = resolveProps(route, configProps);
156+
if (propsToPass) {
157+
// clone to prevent mutation
158+
propsToPass = data.props = extend({}, propsToPass);
159+
// pass non-declared props as attrs
160+
var attrs = data.attrs = data.attrs || {};
161+
for (var key in propsToPass) {
162+
if (!component.props || !(key in component.props)) {
163+
attrs[key] = propsToPass[key];
164+
delete propsToPass[key];
165+
}
166+
}
167+
}
168+
}
169+
145170
function resolveProps (route, config) {
146171
switch (typeof config) {
147172
case 'undefined':
@@ -2880,7 +2905,7 @@ function createHref (base, fullPath, mode) {
28802905
}
28812906

28822907
VueRouter.install = install;
2883-
VueRouter.version = '3.1.4';
2908+
VueRouter.version = '3.1.5';
28842909

28852910
if (inBrowser && window.Vue) {
28862911
window.Vue.use(VueRouter);

0 commit comments

Comments
 (0)