如何在 Vue 組件中格式化貨幣? - How do I format currencies in a Vue component?

問題:

My Vue component is like this :我的 Vue 組件是這樣的:

<template>
    <div>
        <div class="panel-group"v-for="item in list">
            <div class="col-md-8">
                <small>
                   Total: <b>{{ item.total }}</b>
                </small>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        ...
        computed: {
            list: function() {
                return this.$store.state.transaction.list
            },
            ...
        }
    }
</script>

The result of {{ item.total }} is {{ item.total }}

26000000 2600萬

But I want format it to be like this :但我想把它格式化成這樣:

26.000.000,00 26.000.000,00

In jquery or javascript, I can do it在 jquery 或 javascript 中,我可以做到

But, How to do it in vue component?但是,如何在 vue 組件中做到這一點?


解決方案:

參考: https://stackoom.com/en/question/2vINQ
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章