Skip to content

Commit

Permalink
fix(component): 修复无 param 情况下的字符拼接
Browse files Browse the repository at this point in the history
  • Loading branch information
suanmei committed Jul 17, 2018
1 parent 4cdff21 commit 37c9a9f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class CallApp {
*/
pieceScheme(config) {
const { path, param } = config;
const query = Object.keys(param).map(key => `${key}=${param[key]}`).join('&');
const query = typeof param !== 'undefined'
? Object.keys(param).map(key => `${key}=${param[key]}`).join('&')
: '';

return `${this.options.protocol}://${path}?${query}`;
}
Expand Down Expand Up @@ -117,9 +119,11 @@ class CallApp {
generateUniversalLink(config) {
const { host, pathKey } = this.options.universal;
const { path, param } = config;
const query = Object.keys(param).map(key => `${key}=${param[key]}`).join('&');
const query = typeof param !== 'undefined'
? Object.keys(param).map(key => `${key}=${param[key]}`).join('&')
: '';

return `//${host}?${pathKey}=${path}&${query}`;
return `//${host}?${pathKey}=${path}${query ? '&' : ''}${query}`;
}

generateYingYongBao(config) {
Expand Down

0 comments on commit 37c9a9f

Please sign in to comment.