From 3abc4e2cdb2f173b6bb969f78b1ea558046f88fb Mon Sep 17 00:00:00 2001 From: weizhenye Date: Tue, 2 May 2017 00:53:17 +0800 Subject: [PATCH] 0.0.10 --- dist/vue-highcharts.js | 21 ++++++++++++++------- dist/vue-highcharts.min.js | 2 +- package.json | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/dist/vue-highcharts.js b/dist/vue-highcharts.js index 8f7e9b4..6cb45d7 100644 --- a/dist/vue-highcharts.js +++ b/dist/vue-highcharts.js @@ -1,7 +1,7 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('highcharts')) : - typeof define === 'function' && define.amd ? define(['highcharts'], factory) : - (global.VueHighcharts = factory(global.Highcharts)); + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('highcharts')) : + typeof define === 'function' && define.amd ? define(['highcharts'], factory) : + (global.VueHighcharts = factory(global.Highcharts)); }(this, (function (HighchartsOnly) { 'use strict'; HighchartsOnly = 'default' in HighchartsOnly ? HighchartsOnly['default'] : HighchartsOnly; @@ -35,10 +35,19 @@ function clone(obj) { } } +function render(createElement) { + return createElement('div'); +} + function create(tagName, Highcharts, Vue) { var Ctor = Highcharts[ctors[tagName]]; if (!Ctor) { - return null; + return Highcharts.win + ? null + // When running in server, Highcharts will not be instanced, + // so there're no constructors in Highcharts, + // to avoid unmated content during SSR, it returns minimum component. + : { render: render }; } var isRenderer = tagName === 'highcharts-renderer'; var component = { @@ -87,9 +96,7 @@ function create(tagName, Highcharts, Vue) { this._initChart(); }; } else { - component.render = function(createElement) { - return createElement('div'); - }; + component.render = render; component.mounted = function() { this._initChart(); }; diff --git a/dist/vue-highcharts.min.js b/dist/vue-highcharts.min.js index 131044e..1c44061 100644 --- a/dist/vue-highcharts.min.js +++ b/dist/vue-highcharts.min.js @@ -1 +1 @@ -(function(e,r){typeof exports==="object"&&typeof module!=="undefined"?module.exports=r(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],r):e.VueHighcharts=r(e.Highcharts)})(this,function(e){"use strict";e="default"in e?e["default"]:e;var r={highcharts:"Chart",highstock:"StockChart",highmaps:"Map","highcharts-renderer":"Renderer"};function t(e){var r;if(e===null||typeof e!=="object"){return e}if(e instanceof Array){r=[];for(var i=e.length-1;i>=0;i--){r[i]=t(e[i])}return r}if(e instanceof Object){r={};for(var h in e){r[h]=t(e[h])}return r}}function i(e,i,h){var n=i[r[e]];if(!n){return null}var s=e==="highcharts-renderer";var o={name:e,props:s?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_initChart:function(){this._renderChart();if(s){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(s){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new n(this.$el,this.width,this.height)}else{this.chart=new n(this.$el,t(this.options))}}},beforeDestroy:function(){if(s){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}}};var a=/^1\./.test(h.version);if(a){o.template="
";o.ready=function(){this._initChart()}}else{o.render=function(e){return e("div")};o.mounted=function(){this._initChart()}}return o}function h(t,h){var n=h&&h.Highcharts||e;t.prototype.Highcharts=n;for(var s in r){var o=i(s,n,t);o&&t.component(s,o)}}return h}); \ No newline at end of file +(function(e,r){typeof exports==="object"&&typeof module!=="undefined"?module.exports=r(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],r):e.VueHighcharts=r(e.Highcharts)})(this,function(e){"use strict";e="default"in e?e["default"]:e;var r={highcharts:"Chart",highstock:"StockChart",highmaps:"Map","highcharts-renderer":"Renderer"};function t(e){var r;if(e===null||typeof e!=="object"){return e}if(e instanceof Array){r=[];for(var i=e.length-1;i>=0;i--){r[i]=t(e[i])}return r}if(e instanceof Object){r={};for(var h in e){r[h]=t(e[h])}return r}}function i(e){return e("div")}function h(e,h,n){var s=h[r[e]];if(!s){return h.win?null:{render:i}}var o=e==="highcharts-renderer";var a={name:e,props:o?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_initChart:function(){this._renderChart();if(o){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(o){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new s(this.$el,this.width,this.height)}else{this.chart=new s(this.$el,t(this.options))}}},beforeDestroy:function(){if(o){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}}};var d=/^1\./.test(n.version);if(d){a.template="
";a.ready=function(){this._initChart()}}else{a.render=i;a.mounted=function(){this._initChart()}}return a}function n(t,i){var n=i&&i.Highcharts||e;t.prototype.Highcharts=n;for(var s in r){var o=h(s,n,t);o&&t.component(s,o)}}return n}); \ No newline at end of file diff --git a/package.json b/package.json index ae76b77..6634c8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-highcharts", - "version": "0.0.9", + "version": "0.0.10", "description": "Highcharts component for Vue", "main": "dist/vue-highcharts.js", "module": "src/index.js",