diff --git a/src/utils/index.js b/src/utils/index.js index b17f071..e723f09 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -177,6 +177,11 @@ export function getQueryString(name) { return context == null || context == '' || context == 'undefined' ? '' : context } +/** + * 获取当前域名 + * http://www.baidu.com + * @returns {string} + */ export function getCurrentDomain() { return window.location.protocol + '//' + window.location.host } @@ -270,3 +275,18 @@ export function openUrl(url) { a.click() document.body.removeChild(document.getElementById('tduck-link-temp')) } + +/** + * json对象转url参数 + * @param json + * @returns {string|*} + */ +export function jsonToParam(json) { + if (!json) return '' + return Object.keys(json).map(key => { + if (json[key] === undefined) + return '' + return encodeURIComponent(key) + + '=' + encodeURIComponent(json[key]) + }).join('&') +} diff --git a/src/views/form/setting.vue b/src/views/form/setting.vue index c0c5800..eb417d9 100644 --- a/src/views/form/setting.vue +++ b/src/views/form/setting.vue @@ -487,7 +487,8 @@