智能识别收货地址Pro 引用: GitHub - wzc570738205/smartParsePro: 地址智能识别Pro(支持省市区街道/电话/邮编/姓名/身份证号识别)
//1. 下载
npm install address-smart-parse
//2. 引入
import smart from 'address-smart-parse'
//3. 使用
smart('1111')
使用代码
var textAdd = smart("需要识别的地址"); //识别到的地址对象
//识别地址
this.$set(this.对象, "addresseesName", textAdd.name);
this.$set(this.对象, "buyerPhone", textAdd.phone);
var address = "";
if (textAdd.province != undefined) {
address = address + textAdd.province
}
console.log(textAdd.city)
if (textAdd.city != undefined) {
address = address + textAdd.city
}
if (textAdd.county != undefined) {
address = address + textAdd.county
}
if (textAdd.street != undefined) {
address = address + textAdd.street
}
if (textAdd.address != undefined) {
address = address + textAdd.address
}
if (textAdd.province != undefined) {
address = address + textAdd.province
}
this.$set(this.对象, "addresseesPrintAddr", address);
返回数据对象
{
zipCode:710061
province:陕西省
provinceCode:61
city:西安市
cityCode:6101
county:雁塔区
countyCode:610113
street:丈八沟街道
streetCode:610113007
address:高新四路高新大都荟
name:刘国良
phone:13593464918
idCard:211381198512096810
}