[每天進步一點點~] uni-app 隱藏手機號中間四位數、郵箱號碼中間部分隱藏

1. 隱藏手機號中間四位

效果圖:



代碼:

<template>
    <view class="">
        <view class="">我們向{{tel}}發(fā)送了驗證碼</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                tel: '15807716888',
            }
        },
        onShow() {
            this.phoneNumShow()
        },
        methods: {
            //隱藏手機號
            phoneNumShow () {
                let that = this;
                let number = this.tel; //獲取到手機號碼字段
                console.log('手機號', this.tel)
                let mphone = number.substring(0, 3) + '****' + number.substring(7);
                that.tel = mphone
            },
        }
    }
</script>

<style lang="scss" scoped>

</style>

2. 郵箱號中間部分隱藏

效果圖:



代碼:

<template>
    <view class="">
        <view class="">我們向{{ email }}發(fā)送了驗證郵件</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                email: '123456789@qq.com',
            }
        },
        onShow() {
            this.settingemail()
        },
        methods: {
            //隱藏郵箱
            settingemail() {
                let that = this;
                let email = this.email; //獲取到郵箱字段
                console.log('郵箱', this.email)
                let memail = email.substring(0, 3) + '****' + email.substring(9);
                that.email = memail
            },
        }
    }
</script>

<style lang="scss" scoped>
</style>

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容