引入
ts
import { getIPAddress, getIPAddressStr } from 't-comm';
// 不支持 tree-shaking 的项目
import { getIPAddress, getIPAddressStr} from 't-comm/lib/ip/index';
// 只支持 ESM 的项目
import { getIPAddress, getIPAddressStr} from 't-comm/es/ip/index';
getIPAddress()
描述:
获取ip地址
参数:
返回:
字符串,形如 x.x.x.x
示例
ts
getIPAddress() // 10.10.10.10
getIPAddressStr()
描述:
获取ip的字符串
参数:
返回:
字符串,形如 x_x_x_x
示例
ts
getIPAddressStr() // 10_10_10_10