Content-Length: 303537 | pFad | http://github.com/weizhenye/vue-highcharts/commit/7edb8d1432aa0052238da348291959d5e3a659d7

F7 fix unmatched content during SSR · weizhenye/vue-highcharts@7edb8d1 · GitHub
Skip to content

Commit 7edb8d1

Browse files
committed
fix unmatched content during SSR
1 parent 6762413 commit 7edb8d1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/create.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import clone from './clone.js';
22
import ctors from './constrators.js';
33

4+
function render(createElement) {
5+
return createElement('div');
6+
}
7+
48
function create(tagName, Highcharts, Vue) {
59
var Ctor = Highcharts[ctors[tagName]];
610
if (!Ctor) {
7-
return null;
11+
return Highcharts.win
12+
? null
13+
// When running in server, Highcharts will not be instanced,
14+
// so there're no constructors in Highcharts,
15+
// to avoid unmated content during SSR, it returns minimum component.
16+
: { render: render };
817
}
918
var isRenderer = tagName === 'highcharts-renderer';
1019
var component = {
@@ -53,9 +62,7 @@ function create(tagName, Highcharts, Vue) {
5362
this._initChart();
5463
};
5564
} else {
56-
component.render = function(createElement) {
57-
return createElement('div');
58-
};
65+
component.render = render;
5966
component.mounted = function() {
6067
this._initChart();
6168
};
@@ -64,4 +71,3 @@ function create(tagName, Highcharts, Vue) {
6471
}
6572

6673
export default create;
67-

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/weizhenye/vue-highcharts/commit/7edb8d1432aa0052238da348291959d5e3a659d7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy