/**
 * cookies相关操作
 *
 * @author CaiAoLin
 * @date 2018/1/8
 * @version
 */
let Cookies = {
    get: function(name) {
        if(document.cookie.length <= 0) {
            return "";
        }

        let start = document.cookie.indexOf(name + "=");//获取字符串的起点
        if(start < 0) {
            return "";
        }
        // 获取值的起点
        start = start + name.length + 1;
        // 获取结尾处
        let end = document.cookie.indexOf(";", start);
        // 如果是最后一个，结尾就是cookie字符串的结尾
        end = end === -1 ? document.cookie.length : end;
        // 截取字符串返回
        return decodeURI(document.cookie.substring(start, end));
    },
};
