[Vuejs]-Vue3 render template syntax (component) in loop

1👍

Your code is a big red flag. Thats not the way how to work with vue.js

Here an example how it could be done:

<template>
<ol>
   <li v-for="item in items" :key="item.link" >
      <router-link :to="item.link">{{ item.name }}</router-link>
   </li>
</ol>
</template>

<script setup>
const click = ref();
const items = ref([

   {
      name: "Link1",
      link: "/home"
   },
   {
      name: "Link2",
      link: "/login"
   }
]);
</script>

I have no idea what this code is supposed to do @click="click+1"

Also, the v-html attribute isnt a attribute that is common used. Because its also dangerous and leads to XSS vulnerabilities if you are not carefully.

Leave a comment