I have a JS file with a function and component as below:
function emojify(name){
var emj='';
if (name!=''){
emj= '<img src="/static/emojis/'+name+'.png" alt="img" > '
}
return emj
}
Vue.component("cmp2",{ props:["name"] , template: `<p>` + emojify("name") + `</p>`})
I call that component from HTML as below
<cmp2 name="ron" ></cmp2>
Image of ron doesnt show up. But if i declare my component as below it works:
Vue.component("cmp2",{ template:'<p>' + emojify("ron") + '</p>'})
So the image ron exists and works fine. I am just unable to pass value of props name to the function emojify.
How can that be done?