Reputation: 15
new Vue({
el: '#application',
data: {
currencies: [
{
'name': 'Dollar',
'sign': '$'
}, {
'name': 'Euro',
'sign': '€'
}, {
'name': 'Pound',
'sign': '£'
}, {
'name': 'Cent',
'sign': '¢'
}
]
}
});
<select class="custom-select" v-model="quotationForm.currency">
<option v-for="currency in currencies" v-bind:value="currency.sign">
<span v-html="currency.sign"></span>
{{ currency.name }}
</option>
</select>
Currency sign can not been rendered on the select box.
But when i try to make statis it's works fine as per given below...
<select class="custom-select" v-model="quotationForm.currency">
<option v-for="currency in currencies" v-bind:value="currency.sign">
€
{{ currency.name }}
</option>
</select>
Whyv-html
is not works in the select box? have any suggestion
Thank You.
Upvotes: 0
Views: 313
Reputation: 534
I tested it on my own and it's working: Link
<template>
<select class="custom-select" v-model="quotationForm.currency">
<option :key="index" v-for="(currency, index) in currencies" v-bind:value="currency.sign">
<span v-html="currency.sign"></span>
{{ currency.name }}
</option>
</select>
</template>
<script>
export default {
data() {
return {
quotationForm: {
currency: null
},
currencies: [
{
'name': 'Dollar',
'sign': '$'
}, {
'name': 'Euro',
'sign': '€'
}, {
'name': 'Pound',
'sign': '£'
}, {
'name': 'Cent',
'sign': '¢'
}
]
}
}
}
</script>
Upvotes: 2