index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. const { join } = require('path');
  3. module.paths.push(join(Editor.App.path, 'node_modules'));
  4. const Vue = require('vue/dist/vue.min.js');
  5. const eventEditor = require('./editor');
  6. exports.ready = function() {
  7. this.eventEditorVm = new Vue({
  8. el: this.$.eventEditor,
  9. template: eventEditor.template,
  10. data: eventEditor.data,
  11. methods: eventEditor.methods,
  12. components: eventEditor.components,
  13. mounted: eventEditor.mounted,
  14. });
  15. this.eventEditorVm.$on('update', (eventInfos) => {
  16. this.events.updateEventInfo.call(this, eventInfos);
  17. });
  18. this.eventEditorVm.$on('addFunc', (frame, newFuncName) => {
  19. this.events.addEvent.call(this, frame, newFuncName);
  20. });
  21. this.eventEditorVm.$on('delFunc', (frame, eventInfo) => {
  22. this.events.delEvent.call(this, frame, eventInfo);
  23. });
  24. this.eventEditorVm.$on('hide', (frame, eventInfo) => {
  25. this.events.unselect.call(this, frame, eventInfo);
  26. });
  27. };
  28. exports.update = function(editInfo) {
  29. this.eventEditorVm.events = editInfo && editInfo.events || [];
  30. this.eventEditorVm.frame = editInfo && editInfo.frame || 0;
  31. };