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>