Skip to content

is there a way to add a option handle url place for hash or query or both? #347

@ctforcp

Description

@ctforcp

like this

let url = 'https://xxx:8080/h5/?name=121#/pages/topic?payload=13&name=hash-name';

// option place = query | hash | both

queryString.parseUrl(url,{place:"query"})
 // query => {name:121}

queryString.parseUrl(url,{place:"hash"}) 
// query => {payload:13,name:"hash-name"}

queryString.parseUrl(url,{place:"both"})
// query => {payload:13,name:"hash-name"} or {query:{name:121},hash:{payload:13,name:"hash-name"}}


// stringifyUrl both
queryString.stringifyUrl({url,query:{name:'bothname'}},{place:"both"}) 
// => https://xxx:8080/h5/?name=bothname#/pages/topic?payload=13&name=bothname

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions