久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      es6的模塊導(dǎo)出使用什么方法

      es6的模塊導(dǎo)出使用的方法:1、導(dǎo)出默認(rèn)模塊,一個模塊文件只能有一個默認(rèn)模塊,語法為“export default 需要導(dǎo)出的成員”;2、導(dǎo)出普通模塊,一個模塊文件可以有多個普通模塊,語法為“export 按需導(dǎo)出的成員”。

      es6的模塊導(dǎo)出使用什么方法

      本教程操作環(huán)境:windows10系統(tǒng)、ECMAScript 6.0版、Dell G3電腦。

      es6的模塊導(dǎo)出使用什么方法

      默認(rèn)導(dǎo)出

      一個模塊文件只能有一個默認(rèn)模塊,可以有多個普通模塊

      語句:export default 需要導(dǎo)出的成員

      const n1 = 10 const n2 = 20   const show = () => {   console.log('hello') }   export default {   n1,   show }

      默認(rèn)導(dǎo)入

      語句: import 變量的名字 from '模塊標(biāo)識符'

      import m1 from './1.默認(rèn)導(dǎo)出.js' console.log(m1)

      注意事項:

      每個模塊中,只允許使用唯一的一次 export default,否則會報錯!

      默認(rèn)導(dǎo)入時的接收名稱可以任意名稱,只要是合法的成員名稱即可

      按需導(dǎo)出

      可以把任意的數(shù)據(jù)類型作為模塊導(dǎo)出

      語法:按需導(dǎo)出的語法: export 按需導(dǎo)出的成員

      export const n1 = 10   export const n2 = 20

      按需導(dǎo)入

      按需導(dǎo)入的語法: import { m1 } from '模塊標(biāo)識符'

      import { n1 } from './3.按需導(dǎo)出.js'   console.log(n1)

      按需導(dǎo)入與按需導(dǎo)出的注意事項:

      • 每個模塊中可以使用多次按需導(dǎo)出

      • 按需導(dǎo)入的成員名稱必須和按需導(dǎo)出的名稱保持一致

      • 按需導(dǎo)入時,可以使用 as 關(guān)鍵字進(jìn)行重命名

      • 按需導(dǎo)入可以和默認(rèn)導(dǎo)入一起使用

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號