Home > OS >  vue - interpolation html value
vue - interpolation html value

Time:11-01

there is a v-data-table with server side pagination, where I used a formatter for a specific column as described to this enter image description here

CodePudding user response:

Try to use v-html directive :

new Vue({
  el: '#demo',
  data() {
    return {
      price: 555.33
    }
  },
  methods: {
    formatCurrency (value) {
      return '<strong>'   value   '</strong>';
        //'<v-icon dark small>tick-outline</v-icon>'   value;
    },
  }
})

Vue.config.productionTip = false
Vue.config.devtools = false
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
 <div v-html="formatCurrency(price)"></div> 
</div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related