Commit aab09c93 authored by JingChao's avatar JingChao

金额过滤器

parent d521e0c5
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
max-width: 14em; max-width: 14em;
min-height: 3em !important; min-height: 3em !important;
top: 38% !important; top: 38% !important;
border-radius: 0.3rem !important; border-radius: 0.15rem !important;
} }
.weui-toast.vux-toast-top { .weui-toast.vux-toast-top {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<template> <template>
<h-view title="HFile"> <h-view title="HFile">
<h-header> <h-header :has-border="false" class="bar-custom">
<div slot="left" class="h-header-btn" @click="$routeGo()"> <div slot="left" class="h-header-btn" @click="$routeGo()">
<i class="ion-ios-arrow-back"/> <i class="ion-ios-arrow-back"/>
</div> </div>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<tab-item>涉诉公告</tab-item> <tab-item>涉诉公告</tab-item>
<tab-item>司法协助</tab-item> <tab-item>司法协助</tab-item>
</s-tab> </s-tab>
<scroll class="has-footer"> <h-content :listen-scroll="true" class="has-footer" @scroll="scrollListen">
<h-button class="button-class" type="primary" @click.native="showLoading">showLoading</h-button> <h-button class="button-class" type="primary" @click.native="showLoading">showLoading</h-button>
<h-button class="button-class" type="primary" @click.native="hideLoading">hideLoading</h-button> <h-button class="button-class" type="primary" @click.native="hideLoading">hideLoading</h-button>
<h-button class="button-class" type="primary" @click.native="showLongTop">showLongTop</h-button> <h-button class="button-class" type="primary" @click.native="showLongTop">showLongTop</h-button>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</div> </div>
<h2 class="item-title">Modal</h2> <h2 class="item-title">Modal</h2>
<h-button class="button-class" type="primary" @click.native="showModal">Modal</h-button> <h-button class="button-class" type="primary" @click.native="showModal">Modal</h-button>
</scroll> </h-content>
<bottom-tab :show-divider="true"> <bottom-tab :show-divider="true">
<tab-button cusClass="button-exit" @click.native="showConfirm"><img <tab-button cusClass="button-exit" @click.native="showConfirm"><img
...@@ -326,6 +326,9 @@ export default { ...@@ -326,6 +326,9 @@ export default {
}) */ }) */
}, },
methods: { methods: {
scrollListen (e) {
console.log('scroll listen:' + JSON.stringify(e,'',2))
},
stab () { stab () {
console.log('tab-click') console.log('tab-click')
}, },
...@@ -369,13 +372,13 @@ export default { ...@@ -369,13 +372,13 @@ export default {
this.hlsPopup.hideLoading() this.hlsPopup.hideLoading()
}, },
showLongTop () { showLongTop () {
this.hlsPopup.showLongTop('操作成功操作成功') this.hlsPopup.showLongTop('操作成功操作成功操作成功操作成功操作成功操作成功')
}, },
showLongCenter () { showLongCenter () {
this.hlsPopup.showLongCenter('操作成功操作成功') this.hlsPopup.showLongCenter('操作成功操作成功操作成功操作成功操作成功操作成功')
}, },
showLongBottom () { showLongBottom () {
this.hlsPopup.showLongBottom('操作成功操作成功') this.hlsPopup.showLongBottom('操作成功操作成功操作成功操作成功操作成功操作成功')
}, },
showSuccess () { showSuccess () {
this.hlsPopup.showSuccess('操作成功') this.hlsPopup.showSuccess('操作成功')
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
<section slot="name">姓名</section> <section slot="name">姓名</section>
<input slot="content" type="text"> <input slot="content" type="text">
</item> </item>
<item>
<section slot="name">金额</section>
<div slot="content">{{ number | currency }}</div>
</item>
<item> <item>
<section slot="name">年龄</section> <section slot="name">年龄</section>
<input slot="content" type="text"> <input slot="content" type="text">
...@@ -86,6 +90,7 @@ ...@@ -86,6 +90,7 @@
export default { export default {
data () { data () {
return { return {
number: 0.48,
arrarRight: require('../assets/image/right-arrow@2x.png'), arrarRight: require('../assets/image/right-arrow@2x.png'),
userImg: window.localStorage.userImg || '', userImg: window.localStorage.userImg || '',
message: [{ message: [{
......
...@@ -2,9 +2,8 @@ export default (Vue) => { ...@@ -2,9 +2,8 @@ export default (Vue) => {
Vue.filter('currency', function (val) { Vue.filter('currency', function (val) {
if (!val) return '0.00' if (!val) return '0.00'
var intPart = Number(val).toFixed(0) // 获取整数部分 var intPart = parseInt(Number(val)) // 获取整数部分
var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断 var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
var floatPart = '.00' // 预定义小数部分 var floatPart = '.00' // 预定义小数部分
var value2Array = (val + '').split('.') var value2Array = (val + '').split('.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment