title: Adding mouse event to dynamic created element Vuejs
body: <p>I was just wondering have anyone tried doing something like this(this is within a vuejs created method):</p>
  
  <pre><code>for (let i = 0; i &lt; this.items.length; i++) {
      let bar = document.createElement('div');
    bar.className = this.items[i].colour;
    bar.style.cssText = `width: ${this.items[i].weight}%`;
    bar.setAttribute("mouseover", this.showBlock(500, false)); //not working
      document.querySelector('.bar').appendChild(bar);
  }
  </code></pre>
  
  <p><a href="https://jsfiddle.net/phfilly/eywraw8t/167799/" rel="nofollow noreferrer">https://jsfiddle.net/phfilly/eywraw8t/167799/</a></p>
  
  <p>I’m trying to add a hover mouse event(line 32) to the newly created element. Is there another way to achieve something like this?</p>