title: calling method dynamically through variables in vuejs
body: <p>Is it possible to call the method through variables? I have drag and drop elements having ID and according to id I have to call the method.
  Consider the following Eg.</p>
  
  <pre><code>&lt;template&gt;
     &lt;div&gt;
      &lt;div id="draggable"&gt;
        &lt;div class="draggable" id="db"&gt;Step2&lt;/div&gt;
        &lt;div class="draggable" id="spstep"&gt; Step&lt;/div&gt;
        &lt;div class="draggable" id="merge"&gt;Merge&lt;/div&gt;
        &lt;div class="draggable" id="copy"&gt;copy&lt;/div&gt;
      &lt;/div&gt;
       &lt;div id="id="draggable""&gt;Drop Here&lt;/div&gt;
     &lt;/div&gt;
   &lt;/template&gt; 
  
  &lt;script&gt;
    export default {
  
    data () {
  
     }
    mounted () {
    var _this = this
    $(".draggable").draggable({
       grid: [ 20, 20 ],
       appendTo: '#droppable',
       // containment: "window",
       cursor: 'move',
       revertDuration: 100,
       revert: 'invalid',
       helper: 'clone',
       refreshPositions: true,
       scroll: true,
       containment: "document",
        zIndex: 10000,
   });
  
   $("#droppable").droppable({
       accept: ".draggable",
       tolerance: "intersect",
       drop: function (event, ui) {         
         var leftPosition  = pos.left;//ui.offset.left - $(this).offset().left;
         var topPosition   = pos.top;//ui.offset.top - $(this).offset().top;
         console.log(leftPosition + "  "+ topPosition);
         var type = ui.draggable.attr("id");
  
         //Here call methods according to id of draggable element
         //like 
         //current implement which is not enhanced code
         if(type == 'db')
            _this.db()
  
         if(type == 'spstep')
            _this.spstep()
  
         if(type == 'merge')
            _this.merge()
  
         if(type == 'copy')
            _this.copy()   
          //desired implementation alike
          _this.[type]() // this syntax is wrong and throws an error  
         }
       }); 
   }
   methods: {
    db(){
      //db called do something
    }
    spstep(){
      //spstep called do something
    }
    merge(){
      //merge called do something
    }
    copy(){
      //copy called do something
    }
  }
  &lt;/script&gt;
  &lt;style&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>Above is my sample code in which I have mentioned my requirements in comments.I want to call the methods according to dragged element. I don't know even this is possible but by this approach, I can reduce lots of unwanted code.</p>
  
  <p>Any help would be highly appreciated<br>
  Thanks</p>