Skip to content

Commit 2da8cb0

Browse files
committed
0.0.9
1 parent ab216d3 commit 2da8cb0

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

dist/vue-highcharts.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ function clone(obj) {
3535
}
3636
}
3737

38-
function create(tagName, Highcharts) {
38+
function create(tagName, Highcharts, Vue) {
3939
var Ctor = Highcharts[ctors[tagName]];
4040
if (!Ctor) {
4141
return null;
4242
}
4343
var isRenderer = tagName === 'highcharts-renderer';
44-
return {
44+
var component = {
4545
name: tagName,
46-
render: function(createElement) {
47-
return createElement('div');
48-
},
4946
props: isRenderer
5047
? {
5148
width: { type: Number, required: true },
@@ -71,9 +68,6 @@ function create(tagName, Highcharts) {
7168
}
7269
}
7370
},
74-
mounted: function() {
75-
this._initChart();
76-
},
7771
beforeDestroy: function() {
7872
if (isRenderer) {
7973
this.$el.removeChild(this.renderer.box);
@@ -84,19 +78,30 @@ function create(tagName, Highcharts) {
8478
} else {
8579
this.chart.destroy();
8680
}
87-
},
88-
// compat Vue v1.x
89-
ready: function() {
90-
this._initChart();
9181
}
9282
};
83+
var isVue1 = /^1\./.test(Vue.version);
84+
if (isVue1) {
85+
component.template = '<div></div>';
86+
component.ready = function() {
87+
this._initChart();
88+
};
89+
} else {
90+
component.render = function(createElement) {
91+
return createElement('div');
92+
};
93+
component.mounted = function() {
94+
this._initChart();
95+
};
96+
}
97+
return component;
9398
}
9499

95100
function install(Vue, options) {
96101
var Highcharts = (options && options.Highcharts) || HighchartsOnly;
97102
Vue.prototype.Highcharts = Highcharts;
98103
for (var tagName in ctors) {
99-
var component = create(tagName, Highcharts);
104+
var component = create(tagName, Highcharts, Vue);
100105
component && Vue.component(tagName, component);
101106
}
102107
}

dist/vue-highcharts.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-highcharts",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "Highcharts component for Vue",
55
"main": "dist/vue-highcharts.js",
66
"jsnext:main": "src/index.js",

0 commit comments

Comments
 (0)