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


ES6 & import * & import default & import JSON的更多相关文章

  1. JavaScript ES6中export、import与export default的用法和区别

    前言 相信很多人都使用过export.export default.import,然而它们到底有什么区别呢? 在看他们之间的区别之前,我们先来看看它们的用法. ES6 import和export的用法 ...

  2. ES6常用语法简介import export

    ES6常用语法简介import export let与var用法区别 //var var a = []; for (var i = 0; i < 10; i++) { a[i] = functi ...

  3. 第二十四天- 模块导入 import from xxx import xxx

    # 模块:# 模块就是⼀个包含了python定义和声明的⽂件,⽂件名就是模块的名字加上.py后缀# 换句话说我们⽬前写的所有的py⽂件都可以看成是⼀个模块# 为何用模块:写大项目时,把相关的功能进⾏分 ...

  4. golang程序编译时提示“package runtime: unrecognized import path "runtime" (import path does not begin with hostname)”

    在编译golang的工程时提示错误的, 提示的错误信息如下: package bytes: unrecognized import path "bytes" (import pat ...

  5. vue-resource对比axios import ... from和import {} from 的区别 element-ui

    1.vue-resource对比axios 文章1 文章2 1.0 axios  params 配置参数在url 显示,form-data 用于 图片上传.文件上传 1.1 axios 全局配置 ax ...

  6. python基础--自定义模块、import、from......import......

    自定义模块.import.from......import...... 1)模块的定义和分类 1.模块是什么? 我们知道一个函数封装了一个功能,软件可能是有多个函数组成的.我们说一个函数就是一个功能, ...

  7. python中import和from...import区别

    在python用import或者from...import来导入相应的模块.模块其实就是一些函数和类的集合文件,它能实现一些相应的功能,当我们需要使用这些功能的时候,直接把相应的模块导入到我们的程序中 ...

  8. import和from import陷阱二

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 #from os import path import os.path path='/home/vamei/doc/file.txt' ...

  9. python中import和from...import...的区别

    python中import和from...import...的区别: 只用import时,如import xx,引入的xx是模块名,而不是模块内具体的类.函数.变量等成员,使用该模块的成员时需写成xx ...

随机推荐

  1. TCMalloc源码学习(一)

    打算一边学习tcmalloc的源码一边写总结文章.先从转述TCMalloc的一篇官方文档开始(TCMalloc : Thread-Caching Malloc). 为什么用TCMalloc TCMal ...

  2. The OAuth 2.0 Authorization Framework OAuth2.0的核心角色code 扫码登录

    RFC 6749 - The OAuth 2.0 Authorization Framework https://tools.ietf.org/html/rfc6749 The OAuth 2.0 a ...

  3. AutoMapper 10.0使用教程

    这里有个目录 什么是AutoMapper 配置 使用MapperConfiguration配置 使用Profile Instances配置 Naming Conventions(命名约定) Repla ...

  4. 这些年来,一直不知道Code Fisrt的真实意义。

    目录 Code First 是一个糟糕的名字 放弃 EDMX,但继续实行数据库优先 Code First 是一个糟糕的名字 很多人依据它的名字认为,它是在代码定义模型,然后从模型生成数据库. Code ...

  5. 「一本通 1.3 例 5」weight]

    「一本通 1.3 例 5」weight 题面 给定原数列 \(a_1,a_2,a_n\) ,给定每个数的前缀和以及后缀和,并且打乱顺序. 给出一个集合 \(S\) 要求从集合 \(S\) 中找到合适的 ...

  6. Jmeter(三十七) - 从入门到精通进阶篇 - 输出HTML格式的性能测试报告(详解教程)

    1.简介 相对于Loadrunner,Jmeter其实也是可以有测试报告产出的,虽然一般都不用(没有Loadrunner的报告那么强大是一方面),但是有小伙伴们私下问,那宏哥还是顺手写一下吧,今天我们 ...

  7. ElasticSearch 入门简介

    公号:码农充电站pro 主页:https://codeshellme.github.io ElasticSearch 是一款强大的.开源的.分布式的搜索与分析引擎,简称 ES,它提供了实时搜索与聚合分 ...

  8. 设计模式(十五)——命令模式(Spring框架的JdbcTemplate源码分析)

    1 智能生活项目需求 看一个具体的需求 1) 我们买了一套智能家电,有照明灯.风扇.冰箱.洗衣机,我们只要在手机上安装 app 就可以控制对这些家电工作. 2) 这些智能家电来自不同的厂家,我们不想针 ...

  9. sh 脚本名字和./脚本名字有什么区别

    sh xxx用 sh 这个shell (sh一般指系统默认shell,比如 bash, ksh, Csh 等都有可能) 来解释和运行 xxx 这个脚本.xxx 文件不必具有可执行属性(chmod +x ...

  10. P3164 [CQOI2014]和谐矩阵(高斯消元 + bitset)

    题意:构造一个$n*m$矩阵 使得每个元素和上下左右的xor值=0 题解:设第一行的每个元素值为未知数 可以依次得到每一行的值 然后把最后一行由题意条件 得到$m$个方程 高斯消元解一下 bitset ...