|
1 | 1 | (function (global, factory) {
|
2 |
| - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('highcharts')) : |
3 |
| - typeof define === 'function' && define.amd ? define(['highcharts'], factory) : |
4 |
| - (global.VueHighcharts = factory(global.Highcharts)); |
| 2 | + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('highcharts')) : |
| 3 | + typeof define === 'function' && define.amd ? define(['highcharts'], factory) : |
| 4 | + (global.VueHighcharts = factory(global.Highcharts)); |
5 | 5 | }(this, (function (HighchartsOnly) { 'use strict';
|
6 | 6 |
|
7 | 7 | HighchartsOnly = 'default' in HighchartsOnly ? HighchartsOnly['default'] : HighchartsOnly;
|
@@ -35,10 +35,19 @@ function clone(obj) {
|
35 | 35 | }
|
36 | 36 | }
|
37 | 37 |
|
| 38 | +function render(createElement) { |
| 39 | + return createElement('div'); |
| 40 | +} |
| 41 | + |
38 | 42 | function create(tagName, Highcharts, Vue) {
|
39 | 43 | var Ctor = Highcharts[ctors[tagName]];
|
40 | 44 | if (!Ctor) {
|
41 |
| - return null; |
| 45 | + return Highcharts.win |
| 46 | + ? null |
| 47 | + // When running in server, Highcharts will not be instanced, |
| 48 | + // so there're no constructors in Highcharts, |
| 49 | + // to avoid unmated content during SSR, it returns minimum component. |
| 50 | + : { render: render }; |
42 | 51 | }
|
43 | 52 | var isRenderer = tagName === 'highcharts-renderer';
|
44 | 53 | var component = {
|
@@ -87,9 +96,7 @@ function create(tagName, Highcharts, Vue) {
|
87 | 96 | this._initChart();
|
88 | 97 | };
|
89 | 98 | } else {
|
90 |
| - component.render = function(createElement) { |
91 |
| - return createElement('div'); |
92 |
| - }; |
| 99 | + component.render = render; |
93 | 100 | component.mounted = function() {
|
94 | 101 | this._initChart();
|
95 | 102 | };
|
|
0 commit comments