title: Add Event on HTML string of javascript (Vuejs)
body: <p>I'm trying to call the event in the string of JavaScript. </p>
  
  <p>On the <code>buffer</code> I called this event:</p>
  
  <pre><code>@click.prevent = "Buy($event)"
  </code></pre>
  
  <p>But browser won't parse it:</p>
  
  <p><a href="https://i.stack.imgur.com/uHs8W.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uHs8W.jpg" alt="enter image description here"></a></p>
  
  <p>code attempt:</p>
  
  <p>JS:</p>
  
  <pre><code>    var buffer="";
      for(let i=0 ;i &lt; Object.keys(result).length;i++) {
          buffer += "&lt;div class='category-item'&gt;&lt;a class='button-product-info-s' href='/product/"+result[i]['id']+"'/&gt;&lt;img class='product-img-s' src='"+result[i]['pic_url'] +"'&gt;&lt;/a&gt;&lt;p class='product-name-s'&gt;"+result[i]['name']+"&lt;/p&gt;&lt;a @click.prevent='Buy(event)' href=''  class='btns btn-primarys btn-buy-s' value='"+result[i]['id']+"'&gt;Buy&lt;/a&gt;&lt;/div&gt;";
      }
      this.codes= buffer;
  
  //Buy function
  
  Buy:function (event) {
      element= event.currentTarget;
      value = element.getAttribute('value');
              }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;div v-html="codes"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>Problem is brower won't realise that i called the event on the <code>&lt;a&gt;</code> tag not an attribute</strong></p>
  
  <p><code>result</code> is my API data.</p>