ES6 & import * & import default & import JSON
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的更多相关文章
- JavaScript ES6中export、import与export default的用法和区别
前言 相信很多人都使用过export.export default.import,然而它们到底有什么区别呢? 在看他们之间的区别之前,我们先来看看它们的用法. ES6 import和export的用法 ...
- ES6常用语法简介import export
ES6常用语法简介import export let与var用法区别 //var var a = []; for (var i = 0; i < 10; i++) { a[i] = functi ...
- 第二十四天- 模块导入 import from xxx import xxx
# 模块:# 模块就是⼀个包含了python定义和声明的⽂件,⽂件名就是模块的名字加上.py后缀# 换句话说我们⽬前写的所有的py⽂件都可以看成是⼀个模块# 为何用模块:写大项目时,把相关的功能进⾏分 ...
- golang程序编译时提示“package runtime: unrecognized import path "runtime" (import path does not begin with hostname)”
在编译golang的工程时提示错误的, 提示的错误信息如下: package bytes: unrecognized import path "bytes" (import pat ...
- 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 ...
- python基础--自定义模块、import、from......import......
自定义模块.import.from......import...... 1)模块的定义和分类 1.模块是什么? 我们知道一个函数封装了一个功能,软件可能是有多个函数组成的.我们说一个函数就是一个功能, ...
- python中import和from...import区别
在python用import或者from...import来导入相应的模块.模块其实就是一些函数和类的集合文件,它能实现一些相应的功能,当我们需要使用这些功能的时候,直接把相应的模块导入到我们的程序中 ...
- 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' ...
- python中import和from...import...的区别
python中import和from...import...的区别: 只用import时,如import xx,引入的xx是模块名,而不是模块内具体的类.函数.变量等成员,使用该模块的成员时需写成xx ...
随机推荐
- spring 之7种重要设计模式
Spring中涉及的设计模式总结 1.简单工厂(非23种设计模式中的一种) 实现方式: BeanFactory.Spring中的BeanFactory就是简单工厂模式的体现,根据传入一个唯一的标识来获 ...
- pod资源限制和QoS探索
简述 默认情况下,k8s不会对pod的资源使用进行限制,也就是说,pod可以无限使用主机的资源,例如CPU.内存等.为了保障k8s整体环境运行的稳定性,一般情况下,建议是对pod的资源使用进行限制,将 ...
- win10自带输入法突然变成了繁体
有可能是在使用Eclipse/MyEclipse的Ctrl + Shift + F进行代码格式化的时候与输入法的热键冲突了
- Java——break,continue,return语句
break语句: break:用于改变程序控制流 用于do-while.while.for中时,可跳出循环而执行循环后面的语句. break的作用:终止当前循环语句的执行. break还可以用来终止s ...
- Git实践笔记(一)
Git是什么 Git是目前世界上最先进的分布式版本控制系统. 工作原理 / 流程: Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remo ...
- 一篇文章图文并茂地带你轻松学完 JavaScript 原型和原型链
JavaScript 原型和原型链 在阅读本文章之前,已经默认你了解了基础的 JavaScript 语法知识,基础的 ES6 语法知识 . 本篇文章旨在为 JavaScript继承 打下基础 原型 在 ...
- Java一些概念
1.Java先编译后解释 同一个.class文件在不同的虚拟机会得到不同的机器指令(Windows和Linux的机器指令不同),但是最终执行的结果却是相同的. 2.JDK包含JRE,JRE包含JVM, ...
- P1714 切蛋糕 dp+单调队列
题意: 题目描述 在幻想乡,琪露诺是以笨蛋闻名的冰之妖精. 某一天,琪露诺又在玩速冻青蛙,就是用冰把青蛙瞬间冻起来.但是这只青蛙比以往的要聪明许多,在琪露诺来之前就已经跑到了河的对岸.于是琪露诺决定到 ...
- Codeforces Round #645 (Div. 2) C. Celex Update
题目链接:C.Celex Update 题意: 给你如图所示的图形,问从(x1,y1)−>(x2,y2)路径上的不同的元素和的数量是多少. 题解: 从(1,1)到(3,3) 元素和的1−2−4− ...
- Educational Codeforces Round 89 (Rated for Div. 2)D. Two Divisors 线性筛质因子
题目链接:D:Two Divisors 题意: 给你n个数,对于每一个数vi,你需要找出来它的两个因子d1,d2.这两个因子要保证gcd(d1+d2,vi)==1.输出的时候输出两行,第一行输出每一个 ...