SoFunction
Updated on 2025-04-04

vue converts the number to Chinese capitalization amount

Convert the number to Chinese capital amount

Remember to introduce files

<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>usevueConvert the number to Chinese capital amount</title>
	<script src=''></script>
</head>
<body>
	<div >
		<h1 v-if='flag'>I've limited the length,Give up</h1>
		<h1 v-if='flag'><button @click='shutDown'>closure</button></h1>
		<input type="text" v-model='inputVal'>
		<!--<button @click='to_ch'>Convert</button>-->
		{{inputVal | toChies}}
		<!--Filter-->
	</div>	
</body>
	<script>
		var app = new Vue({
			el:"#box",
			data:{
				inputVal:'',
				flag:false,
				values:''
			},
			filters:{//Local filter			
			
				toChies:function(values){//Formal parameters					let len=//Calculate the length					let arr=[];
					
					let chin_list=['zero','one','two','3','Si','Wu','land','Qi','eight','Nine']//The Chinese characters corresponding to all values					
					let chin_lisp=['thousand','Bai','pickup','100 million','thousand','Bai','pickup','Ten thousand','thousand','Bai','pickup']//Binding					
					for(let i=0;i<len;i++){
						(parseInt(values[i]));		//The input data is stored in accordance with the index. All the data is stored in is number.						arr[i]=chin_list[arr[i]]			//It is based on the number of inputs we input, corresponding to our chin_list array					}//123['1','bai','2','shi','3']					
					for(let i=len-1,j=1;i>0;i--){//i =2 1 //Inverted order In order to add the binary system, it is convenient for us to watch						(i,0,chin_lisp[chin_lisp.length-j++])	//j=2
					}
					(arr)
					
					arr=('')
					if(len>=1){
						arr+='Yuanzhen'
					}
					return arr
				}
				
				
			},
			watch:{
				inputVal(newVal,oldVal){
					if(==13){
						=oldVal
						=true
					}
				}
			},
			methods:{
				shutDown(){
					=false
				},
				to_ch(){
					()
					=
				}
			}
		})
	</script>
</html>

Real-time conversion of numbers (amount) upper and lower case

<el-col :span="12">
   <el-form-item :label="$t('Tax amount not included')" prop="taxNotIncluded">
      <el-input v-model="" :placeholder="$t('Tax amount not included')" show-word-limit @input="computeLen1()" />
   </el-form-item>
</el-col>
 
<el-col :span="12">
   <el-form-item :label="$t('Excluding tax amount(capital)')" prop="taxNotIncludedCapital">
      <el-input v-model="" :placeholder="$t('Excluding tax amount(capital)')" show-word-limit maxlength="32" />
   </el-form-item>
</el-col>
 
 
computeLen1(number) {
            let ret = ''
              if (number !== '' && number != null && number !== '0') {
                let unit = 'Qian Bailiuqian Bailiuqian Bailiuqian Bailiuqian Bailiuqian Bailiuqian Bailiuqian Bailiuqian Yuanliuqian Jiaoji'
                let str = ''
                number += '00'
                const point = ('.')
                if (point >= 0) {
                  number = (0, point) + (point + 1, 2)
                }
                unit = ( - )
                for (let i = 0; i < ; i++) {
                  str +=
                    'Zero One, Two Three, Si Wu Lu Qi Eight Nine'.charAt((i)) + (i)
                }
                ret =
                  str
                    .replace(/zero(thousand|Bai|pickup|horn)/g, 'zero')
                    .replace(/(zero)+/g, 'zero')
                    .replace(/zero(Ten thousand|100 million|Yuan)/g, '$1')
                    .replace(/(100 million)Ten thousand|(pickup)/g, '$1$2')
                    .replace(/^Yuanzero?|zero分/g, '')
                    .replace(/Yuan$/g, 'Yuan') + 'all'
              }
               = ret
          },

@input event: Real-time operation event

Process: Pass the parameter (123) through the @input event into the computeLen1 method, and through a series of operations, finally get the ref (one hundred 20,000 yuan in total), and assign it to

The above is personal experience. I hope you can give you a reference and I hope you can support me more.