• xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!


    ES6 & import * & import default & import JSON

    import json & default value bug

    api.json

    
    {
        "attention": {
            "add": "/isv/duck/app/user/attention/add"
        }
    }
    
    
    

    apis.js

    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description APIs
     * @augments
     * @example
     * @link
     *
     */
    
    
    import * as API from "./api.json";
    
    // let log = console.log;
    // log(`API =`, JSON.stringify(API, null, 4));
    
    const APIs = API || {};
    
    export default APIs;
    
    export {
        APIs,
    };
    
    
    

    ip.json

    
    {
        "test": "http://1.110.18.184:8080",
        "dev": "http://1.110.18.184:8080",
        "development": "http://1.110.18.184:8080",
        "preview": "",
        "production": ""
    }
    
    
    

    ips.json

    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description IPs
     * @augments
     * @example
     * @link
     *
     */
    
    // import * as IP from "./ip.json";
    import IP from "./ip.json";
    
    let log = console.log;
    log(`IP =`, JSON.stringify(IP, null, 4));
    
    const IPs = IP || {};
    
    export default IPs;
    
    export {
        IPs,
    };
    
    
    

    testing

    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description addAttention 添加关注(包含企业,领域)
     * @augments POST /isv/duck/jintan/user/attention/add
     * @example
     * @link
     *
     */
    
    import IPs from "./ips.js";
    import APIs from "./apis.js";
    // import {IPs} from "./ips.js";
    // import {APIs} from "./apis.js";
    
    const addAttention = (datas = [], debug = false) => {
        let result = ``;
        // do something...
        let log = console.log;
        // let error = console.error;
        log(`IPs =`, JSON.stringify(IPs, null, 4));
        log(`APIs =`, JSON.stringify(APIs, null, 4));
        return result;
    };
    
    export default addAttention;
    
    export {
        addAttention,
    };
    
    
    

    ES6 Destructor

    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description IPs
     * @augments
     * @example
     * @link
     *
     */
    
    import IP from "./ip.json";
    
    // const IPs = IP || {};
    
    let {
        dev,
    } = IP;
    
    const IPs = {
        dev,
    };
    
    export default IPs;
    
    export {
        IPs,
    };
    
    
    
    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description IPs
     * @augments
     * @example
     * @link
     *
     */
    
    import IP from "./ip.json";
    
    // const IPs = IP || {};
    
    let {
        dev,
    } = IP;
    
    const IPs = {
        dev,
    };
    
    const IP_DEV = dev;
    
    export default IPs;
    
    export {
        IPs,
        IP_DEV,
    };
    
    
    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description IPs
     * @augments
     * @example
     * @link
     *
     */
    
    import IP from "./ip.json";
    
    // const IPs = IP || {};
    
    let {
        dev,
        app,
    } = IP;
    
    const IPs = {
        dev,
        app,
    };
    
    const IP_DEV = dev;
    const IP_APP = app;
    
    export default IPs;
    
    export {
        IPs,
        IP_DEV,
        IP_APP,
    };
    
    
    

    apis

    
    "use strict";
    
    /**
     *
     * @author xgqfrms
     * @license MIT
     * @copyright xgqfrms
     *
     * @description APIs
     * @augments
     * @example
     * @link
     *
     */
    
    import API from "./api.json";
    
    let {
        attention,
        search,
    } = API;
    
    const API_Attention = attention;
    const API_Search = search;
    
    const APIs = API || {};
    
    export default APIs;
    
    export {
        APIs,
        API_Attention,
        API_Search,
    };
    
    
    
    
    {
        "attention": {
            "add": "/isv/duck/app/user/attention/add"
        },
        "search": {
            "get": "/isv/duck/app/search/get",
            "post": "/isv/duck/app/search/post"
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    第二周选答题-myod
    第六周实验-模块与系统调用
    2019-2020-11 20199313《Linux内核原理与分析》第十二周作业
    2019-2020-1 20199313《Linux内核原理与分析》第十一周作业
    2019-2020-1 20199313《Linux内核原理与分析》第九周作业
    2019-2020-1 20199313《Linux内核原理与分析》第八周作业
    20199322 2019-2020-2 《网络攻防实践》第4周作业
    20199322 2019-2020-2 《网络攻防实践》第三周作业
    20199322 2019-2020-2 《网络攻防实践》第2周作业
    20199322 2019-2020-2 《网络攻防实践》第一周作业
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/11150022.html
Copyright © 2020-2023  润新知