• 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 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    Xcode9新特性介绍-中文篇
    基于Mac制作iPhone铃声教程,iTunes定制铃声
    浅谈Swift和OC的区别
    Your password has expired. To log in you must change it using a client that supports expired passwords.
    浅谈测试驱动开发(TDD)
    ClientAbortException: java.net.SocketException: 断开的管道
    nohup top & 问题: top: failed tty get
    rsync 学习
    myeclipse项目 不能打开
    ChannelSftp 远程下载目录
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/11150022.html
Copyright © 2020-2023  润新知