标签:++ 获取 cti ring value get ons val sea
1.获取URL search参数
import qs from ‘qs‘
export default function getQueryParam(param) {
let { search } = window.location;
search = search.slice(1);
const params = qs.parse(search);
if (param) {
return Object.prototype.hasOwnProperty.call(paramss, param)
? params[param]
: null;
}
return params;
}
export function pick(obj, fn = (key, value) => !!value || value === 0) {
const ret = {};
if (obj) {
Object.keys[obj].forEach(key => {
if (fn(key, obj[key])) {
ret[key] = obj[key];
}
});
}
return ret;
}
export function getCookie(cookieName) {
const name = `${cookieName}=`;
const cookies = document.cookie.split(‘;‘);
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
if (cookie.indexOf(name) === 0) {
return cookie.substring(name.length, cookie.length);
}
}
return ‘‘;
}
export function getCToken(){
return getCookie(‘ctoken‘);
}
标签:++ 获取 cti ring value get ons val sea
原文地址:https://www.cnblogs.com/lei--lei/p/10206554.html