Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue.js render plugin #169

Closed
Ni55aN opened this issue Aug 31, 2018 · 2 comments
Closed

Vue.js render plugin #169

Ni55aN opened this issue Aug 31, 2018 · 2 comments

Comments

@Ni55aN
Copy link
Member

Ni55aN commented Aug 31, 2018

No description provided.

@Ni55aN
Copy link
Member Author

Ni55aN commented Sep 1, 2018

Initial version: https://github.com/retejs/vue-render-plugin
Testing required

Example of use:

var comp = {
     props: ['readonly', 'emitter', 'ikey'],
     template: '<input type="number" :readonly="readonly" :value="value" @input="change($event)"/>',
      data() {
           return {
               value: 0,
           }
      },
     methods: {
          change(e){
              this.value = +e.target.value;
              this.update();
          },
          update() {
             if (this.ikey)
                 this.putData(this.ikey, this.value)
             this.emitter.trigger('process');
         }
       },
       mounted() {
          this.value = this.getData(this.ikey);
       }
  }


 class NumControl extends Rete.Control {

   constructor(emitter, key, readonly) {
      super(key);
      this.emitter = emitter;
       this.key = key;
       this.component = comp;
       this.props = { emitter, ikey: key, readonly };
   }

    setValue(val) {
       this.component.value = val;
    }
}

@Ni55aN
Copy link
Member Author

Ni55aN commented Sep 2, 2018

@Ni55aN Ni55aN closed this as completed Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant