个人笔记

作者: 刘凯gg | 来源:发表于2019-08-09 14:23 被阅读7次

    转换FromData

       objectToFormData(obj, form, namespace) {
            const fd = form || new FormData();
            let formKey;
            for (var property in obj) {
                if (obj.hasOwnProperty(property)) {
                    let key = Array.isArray(obj) ? '[]' : `[${property}]`;
                    if (namespace) {
                        formKey = namespace + key;
                    } else {
                        formKey = property;
                    }
                    // if the property is an object, but not a File, use recursivity.
                    if (typeof obj[property] === 'object' && !(obj[property] instanceof File)) {
                        objectToFormData(obj[property], fd, formKey);
                    } else {
                        // if it's a string or a File object
                        fd.append(formKey, obj[property]);
                    }
                }
            }
            return fd;
        }
    

    退出登录重新启动app获取cid

    
    // 扩展API加载完毕后调用onPlusReady回调函数 
    document.addEventListener( "plusready", onPlusReady, false );
    var r = null; 
    // 扩展API加载完毕,现在可以正常调用扩展API 
    function onPlusReady() {
        plus.runtime.restart(); // 重新启动app
    }
    
    

    相关文章

      网友评论

        本文标题:个人笔记

        本文链接:https://www.haomeiwen.com/subject/jpqhjctx.html