Skip to content

Commit

Permalink
0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhenye committed Nov 10, 2016
1 parent ab216d3 commit 2da8cb0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
31 changes: 18 additions & 13 deletions dist/vue-highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ function clone(obj) {
}
}

function create(tagName, Highcharts) {
function create(tagName, Highcharts, Vue) {
var Ctor = Highcharts[ctors[tagName]];
if (!Ctor) {
return null;
}
var isRenderer = tagName === 'highcharts-renderer';
return {
var component = {
name: tagName,
render: function(createElement) {
return createElement('div');
},
props: isRenderer
? {
width: { type: Number, required: true },
Expand All @@ -71,9 +68,6 @@ function create(tagName, Highcharts) {
}
}
},
mounted: function() {
this._initChart();
},
beforeDestroy: function() {
if (isRenderer) {
this.$el.removeChild(this.renderer.box);
Expand All @@ -84,19 +78,30 @@ function create(tagName, Highcharts) {
} else {
this.chart.destroy();
}
},
// compat Vue v1.x
ready: function() {
this._initChart();
}
};
var isVue1 = /^1\./.test(Vue.version);
if (isVue1) {
component.template = '<div></div>';
component.ready = function() {
this._initChart();
};
} else {
component.render = function(createElement) {
return createElement('div');
};
component.mounted = function() {
this._initChart();
};
}
return component;
}

function install(Vue, options) {
var Highcharts = (options && options.Highcharts) || HighchartsOnly;
Vue.prototype.Highcharts = Highcharts;
for (var tagName in ctors) {
var component = create(tagName, Highcharts);
var component = create(tagName, Highcharts, Vue);
component && Vue.component(tagName, component);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/vue-highcharts.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-highcharts",
"version": "0.0.8",
"version": "0.0.9",
"description": "Highcharts component for Vue",
"main": "dist/vue-highcharts.js",
"jsnext:main": "src/index.js",
Expand Down

0 comments on commit 2da8cb0

Please sign in to comment.