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. Obligations for calling close() on the iterable returned by a WSGI application

    Graham Dumpleton: Obligations for calling close() on the iterable returned by a WSGI application. ht ...

  2. linux 文件结构体和文件描述符号的学习

    https://blog.csdn.net/cywosp/article/details/38965239

  3. MonkeyScript

    MonkeyScript的简单使用 一. 什么是MonkeyScript MS 是官方提供的,除了像猴子一样随机乱点之外,还可以通过编写脚本的形式,完成一系列固定的操作.MS 提供一整套完善的 API ...

  4. HMS Core华为分析丨受众细分,多场景促进精益运营

    用户的偏好不同,对产品的需求也不一样,要想更好地培养用户粘性,就需要因人施策,精细化运营,而受众细分是精细化运营的重要方法之一.受众细分是根据用户属性和行为数据,将具有相同或类似特征的用户归为一个群组 ...

  5. 利用Javascript制作网页特效(时间特效)

    在网页中经常可以看到各种各样的动态时间显示,在网页中合理地使用时间可以增加网页的时效感. 显示当前时间 getHours().getMinutes().getSeconds()分别获得当前小时数.当前 ...

  6. RIDE对应驱动下载

    https://blog.csdn.net/apollolkj/article/details/75408237

  7. 数据库MySQL——SQL语句(命令)

    SQL语句分类 DCL (Data Control Language):数据控制语言:用来管理用户及权限 DDL(Data Definition Language):数据定义语言:用来定义数据库对象: ...

  8. UML实战总结——机房收费系统UML第一版部分图展

    距离机房收费系统已经过去了近2个月之久,如今的UML图才出来,从软件开发设计的逻辑上来讲这是顺序有问题的,不过,对于我们而言,而且是初次用面向对象的思想去设计和建模,就当是UML的一个实战练手的项目吧 ...

  9. 小白搭建WNMP详细教程---NGINX、MYSQL、PHP的整合配置

    我自定义安装后的目录结构如下: 安装在D盘的WNMP下,其中WWW是网站的目录.ZIPS是放压缩包文件. 一.配置环境变量 在桌面右击我的电脑,选择属性,出现窗口后,按下图所示操作: 点击编辑后,会出 ...

  10. Flink-v1.12官方网站翻译-P015-Glossary

    术语表 Flink Application Cluster Flink应用集群是一个专用的Flink集群,它只执行一个Flink应用的Flink作业.Flink集群的寿命与Flink应用的寿命绑定. ...