Closed gwumkt closed 5 years ago
Why just not to use an <a>
tag wihout v-runtime-template like these:
<tr v-show="ajaxing == false" v-for="(item,index) in items">
<template v-for="(action,index) in TableSettings.actions">
<a class='text-white hover-info' :href="`Edit.aspx?id=${item.id}`">Edit</a>
</template>
</tr>
Because as i said, the a tag is coming from a variable action.html .. you can see that i have for loop on TableSettings.actions, every action can be diff thing.. it can be a tag or even a button or anything..
What about using <div v-html="action.html">
with a :href
above?
it will not work cause action.html contains item.id, and the v-html will not render that item.id..
ok guys i solved it by looking at the source code of that lib.
<v-runtime-template :template-props="{item}" :template="action.html"></v-runtime-template
im passing the item in the template-props so then the item is now accessible from the template
item is a object that contains an id such as:
action.html have:
<a class='text-white hover-info' :href="'Edit.aspx?id=' + _.get(this,'id')">Edit</a>
but _.get(this,'id') is undefine..