I created a component which is supposed to display a font icon :
<template>
<Image :src.decode="code" />
</template>
<script>
const mapping = {wi_owm_200:"",wi_owm_201:"",wi_owm_202:""};
export default {
props: {
icon: String,
},
data() {
return {
code: String,
};
},
created() {
this.code = 'font://' + mapping[this.icon];
}
};
</script>
In my main page I have this code calling my component :
<template>
<page>
<StackLayout>
<myComponent icon="wi_owm_200" />
</StackLayout>
</page>
</template>
<script>
import myComponent from "./myComponent";
export default {
components: {
myComponent
}
}
</script>
When I compile, instead of my pretty icon, I will get the code ""... Meanwhile, directly in my main page this will work out perfectly :
<Image src.decode="font://" />
Here is the playground, if you want to check it live
Any idea to make my component work ?
For Button dynamically I use :text="code"
(instead of text.decode="& #xf164;"
), where
code = String.fromCharCode(0xf164);
Try it for Image!