智能识别收货地址Pro 引用: https://github.com/wzc570738205/smartParsePro 引用方式:
//1. 下载
npm install address-smart-parse
//2. 引入
import smart from 'address-smart-parse'
//3. 使用
// console.log(smart('xxxxxxx))
vue代码使用示例:
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
}