console
var app = new Vue({
el: '#app',
data:{
newP:[],
price:'1,111.00',
pT:['十','千','百','亿','十','万','千','百','十','元','角','分']
},
mounted(){
this.handlePrice(this.price)
},
methods:{
handlePrice(tt){
let tp = tt;
tp = tt.replace(/\./g,'').replace(/\,/g,'')
let newPs = '¥'+ tp;
this.newP = newPs.split('')
if(this.newP.length < this.pT.length){
let sth = this.pT.length - this.newP.length;
for(var i = 0 ; i<sth;i++){
this.newP.unshift('')
}
}
}
}
})
<div id="app">
<table class="table-wrapper" cellpadding="0" cellspacing="0">
<tr>
<td v-for="(item,index) in pT" :key="index">
{{item}}
</td>
</tr>
<tr>
<td v-for="(value,index) in newP" :key="index">
{{
value
}}
</td>
</tr>
</table>
</div>
.table-wrapper{
height:100px;
border:1px solid #000;
}
.table-wrapper td{
border:1px solid #000;
padding:10px;
}