Vue

by Dedi Wibisono

HTML

<div id="app">
  <ul>
    <template v-for="(check, i) in checking">
      <li 
        :key="i" 
        v-html="check.text"
        @click="check.onclick"        
        > {{ i }} </li>
    </template>
  </ul>
</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

del {
  color: rgba(0, 0, 0, 0.3);
}

.click {
  cursor: pointer;
  color:red;
}

Vue

new Vue({
  el: "#app",
  data: {
    checking: [
      { text: "<a Event 1 class='click'>click here</a>", onclick: () => {alert('clicked without method')} },
      { text: "<b>Event 2</b>" },
      { text: "Event 3" },
      { text: "Event 4" }
    ]
  },
  methods: {
    test() {
      alert("clicked")
    }
  }
})