1.1.1 • Published 4 years ago
enter-search-url v1.1.1
获取路由search参数
npm i search-url -D
import SearchUrl from 'search-url'
const UrlUtil = new SearchUrl()
// http://www.xxx.com/?type=1&code=2/#/
<!-- getPreValue -->
UrlUtil.SearchUrl('type') // 1
<!-- format -->
UrlUtil.format() // {type: 1, code: 2}
<!-- insetUrl -->
UrlUtil.insetUrl({login: true}) // http://www.xxx.com/?type=1&code=2&login=true/#/
<!-- go -->
UrlUtil.insetUrl({login: true}).go() // http://www.xxx.com/?type=1&code=2&login=true/#/
使用方法
方法 | 类型 | 描述 |
---|---|---|
format | function | 获取链接参数 |
getPreValue | function | 获取链接参数指定的key |
insetUrl | function | 向链接参数中插入指定的key |
delParams | function | 删除链接参数中指定的key |
go | function | 一般结合insetUrl使用 跳转到插入的新路径 |