movie javascript code around

This commit is contained in:
Yanick Champoux 2018-01-15 18:40:59 -05:00
parent 4d4157aa72
commit 6ca74bd282
6 changed files with 32 additions and 25 deletions

24
src/SvgPanZoom.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<div>
<slot />
</div>
</template>
<script>
import svg_pan_zoom from 'svg-pan-zoom';
import props from './props';
export default {
props,
mounted: 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 );
},
};
</script>

4
src/index.js Normal file
View File

@ -0,0 +1,4 @@
import SvgPanZoom from './SvgPanZoom.vue';
export { SvgPanZoom };
export default SvgPanZoom;

View File

@ -30,7 +30,7 @@
<script> <script>
import SvgPanZoom from './index.vue'; import SvgPanZoom from './index';
export default { export default {
computed: { computed: {

View File

@ -1,13 +1,4 @@
<template> export default {
<div>
<slot />
</div>
</template>
<script>
import svg_pan_zoom from 'svg-pan-zoom';
let props = {
'zoomEnabled': { type: Boolean, default: true }, 'zoomEnabled': { type: Boolean, default: true },
'controlIconsEnabled': { type: Boolean, default: false }, 'controlIconsEnabled': { type: Boolean, default: false },
'fit': { type: Boolean, default: true }, 'fit': { type: Boolean, default: true },
@ -30,15 +21,3 @@ let props = {
, customEventsHandler: { } , customEventsHandler: { }
, eventsListenerElement: { } , eventsListenerElement: { }
}; };
export default {
props,
mounted: 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 );
},
};
</script>

View File

@ -1,6 +1,6 @@
import { storiesOf } from '@storybook/vue'; import { storiesOf } from '@storybook/vue';
import { withKnobs, text, number, boolean } from '@storybook/addon-knobs'; import { withKnobs, text, number, boolean } from '@storybook/addon-knobs';
import SvgPanZoom from './index.vue'; import SvgPanZoom from './index';
import RawTiger from './RawTiger.vue'; import RawTiger from './RawTiger.vue';

View File

@ -11,7 +11,7 @@
<script> <script>
import { SvgPanZoom, SvgPanZoomThumbnail } from './index.vue'; import { SvgPanZoom, SvgPanZoomThumbnail } from './index';
export default { export default {
components: { SvgPanZoom, SvgPanZoomThumbnail }, components: { SvgPanZoom, SvgPanZoomThumbnail },