<div id="app">
        <ul>
            <li v-for="item in num">{{item | hideMiddle}}</li>
        </ul>
    </div>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
   new Vue({
       el: '#app',
       data: {
         num: ["1234567897897","5648754542132"]
       },
       methods: {            
       },
       filters: {
         hideMiddle(val) {
             return `${val.substring(0,3)}****${val.substring(val.length-3)}`
           }
         }
        })
    </script>

 

Logo

前往低代码交流专区

更多推荐