zoukankan      html  css  js  c++  java
  • import * as x from 'xx' 和 import x from 'xx'

    普通xx.js文件

    //不可变的依赖模拟数据
    module.exports=[
        {
            id: "d52dccfc-656d-11e8-b153-7cd30ad3aa7a",
            regionCode: "Chinese",
            parentId: "97e73c0e-b917-498b-947a-228b39b56d99",
            regionName: "中国",
            regionType: 0,
            list: [
                {
                    id: "1d532b55e-656d-11e8-b153-7cd30ad3aa7a",
                    regionCode: "320000000000",
                    parentId: "d52dccfc-656d-11e8-b153-7cd30ad3aa7a",
                    regionName: "江苏省",
                    regionType: 0,
                    list: []
                },
                {
                    id: "656d-11e8-b153-7cd30ad3aa7a",
                    regionCode: "3200000000001",
                    parentId: "d52dccfc-656d-11e8-b153-7cd30ad3aa7a",
                    regionName: "浙江省",
                    regionType: 0,
                    list: []
                }
            ]
        },
        {
            id: "d62dccfc-656d-11e8-b153-7cd30ad3aa7b",
            regionCode: "Chinese2",
            parentId: "96e73c0e-b917-498b-947a-228b39b56d99",
            regionName: "韩国",
            regionType: 0,
            list: [
                {
                    id: "d532b55e-656d-11e8-b153-7cd30ad3aa7a1",
                    regionCode: "320000000000",
                    parentId: "d52dccfc-656d-11e8-b153-7cd30ad3aa7a",
                    regionName: "京畿道",
                    regionType: 0,
                    list: []
                },
                {
                    id: "d532b55e-656d-11e8-b153-7cd30ad3aa",
                    regionCode: "320000000000",
                    parentId: "d52dccfc-656d-11e8-b153-7cd30ad3aa7a",
                    regionName: "江原道",
                    regionType: 0,
                    list: []
                }
            ]
        }
    ];
    import * as x from "xx.js";
      console.log(x);

    import x from "xx.js";
      console.log(x);  
    效果与 console.log(require('xx.js')) 相同
          与 import * as x from "xx.js"; 打印结果中的default相同

     

    https://segmentfault.com/q/1010000008316030

  • 相关阅读:
    [BZOJ3195][Jxoi2012]奇怪的道路
    [codeforces696B]Puzzles
    [codeforces464D]World of Darkraft
    [COGS1000]伊吹萃香 最短路
    [BZOJ4653][NOI2016]区间 贪心+线段树
    [BZOJ4540][HNOI2016]序列 莫队
    [BZOJ4870][Shoi2017]组合数问题 dp+矩阵乘
    Loj 2005 相关分析
    Loj 114 k大异或和
    bzoj 2212 Tree Rotations
  • 原文地址:https://www.cnblogs.com/jcz1206/p/9633034.html
Copyright © 2011-2022 走看看