refactor the code a wee bit

This commit is contained in:
Yanick Champoux 2018-01-15 18:57:05 -05:00
parent 5d14ddbe41
commit d78020a6bd

View File

@ -12,12 +12,21 @@ import props from './props';
export default {
props,
mounted: function() {
let options = {};
computed: {
options: function() {
let options = {};
Object.keys(props).filter( k => this[k] !== undefined ).forEach( k => options[k] = this[k] );
console.log(options);
svg_pan_zoom( this.$slots.default[0].elm , options );
const is_defined = k => this[k] !== undefined;
Object.keys(props)
.filter( is_defined )
.forEach( k => options[k] = this[k] );
return options;
}
},
mounted: function() {
svg_pan_zoom( this.$slots.default[0].elm , this.options );
},
};