import qs from 'query-string'

export function buildUrl(url, params) {
  const buildParams = qs.stringify(params)
  if (buildParams) {
    if (url.indexOf('?') >= 0) {
      url += '&' + buildParams
    } else {
      url += '?' + buildParams
    }
  }
  return url
}

/**
 * 子应用跳转
*/
export function navigateTo(url, params) {
  window.history.pushState('', '', buildUrl(url, params))
}
