uniapp价格保留两位小数点
文章描述:
uniapp价格字段转换保留两位小数点
template
<template>
	<view class="content">
		{{toFixed(price)}}
	</view>
</template>
script
var _self;
export default{
	data(){
		return{
			price:1,
		}
	},
	onLoad() {
		_self = this
	},
	onShow() {
		
	},
	methods:{
		toFixed(val){
			var str = val.toFixed(2)
			return str;
		}
		//...
	}
}
发布时间:2023/02/24 
                
            
发表评论