当前位置:网站首页>ES6 modularization
ES6 modularization
2022-07-25 01:03:00 【A2258908698】
The default is derived And The default import
Default export Syntax :
export default Default export member
let title = 'node_1.js Members of ';
// The default is derived
export default {
title
}Default import Syntax :
import Receiving name from ' Module identifier ( route )'
// The default import
import title from './node_1'
console.log(title); // {title: 'node_1.js Members of '}The name of the default import can be arbitrary ( such as : aaa, bbb)
Export... On demand And Import on demand
Export... On demand
// Export... On demand
export let title2 = 'title2 The content of ';
perhaps
let title2 = 'title2 The content of ';
export {
title2
}Import on demand
// Import on demand
import { title2 } from './node_1'
console.log(title2); // title2 The content of Import modify name on demand
// Import on demand
import { title2 as title3 } from './node_1' // Use as take title2 It is amended as follows title3
console.log(title3); // title2 The content of Be careful :
The page can have both on-demand export and default Export , How many can be exported on demand , But there can't be many default exports ;
The default import and on-demand import can be carried out on the same line
// The default import and Import on demand At the same time
import title, { title2 } from './node_1'Import and execute module code directly
Simply execute the module code , No need to export and import
index_1.js
// index_1.js Code
for (let i = 0; i < 3; i++) {
console.log(i);
}index_2.js
// index_2.js Code
import './node_1'; // It's just for index_1.js Code execution , No need to receive 边栏推荐
- The first meta universe auction of Chen Danqing's printmaking works will open tomorrow!
- Implementing DDD based on ABP -- domain logic and application logic
- paddlepaddle论文系列之Alexnet详解(附源码)
- Some of my understanding about anti shake and throttling
- BisinessCardGen
- Divide 300000 bonus! Deeperec CTR model performance optimization Tianchi challenge is coming
- 360 interview summary 2013 campus recruitment 2012-4-4
- record
- js && ||
- Codeworks round 649 (Div. 2) ABC problem solution
猜你喜欢

If real-time intersection with line segments in online CAD drawings is realized

What is the root password of MySQL initial installation

Uncaught typeerror: cannot read properties of null (reading 'append') solution

Advanced multithreading (Part 2)

基于ABP实现DDD--领域逻辑和应用逻辑

Pursue and kill "wallet Assassin" all over the network

js && ||

Summary of MATLAB basic grammar

BGP machine room and BGP

7.24 party notice
随机推荐
Nacos hand to hand teaching [i] dynamic configuration of Nacos
Record the bugs encountered and some work experience
Screenshot of Baidu map
How to implement the server anti blackmail virus system is a problem we have to consider
asp adodb.stream对象的方法属性
About the difference between for... In and for... Of and object. Keys()
进程的几种状态
Esp32 OLED lvgl displays common Chinese characters
7.19 - daily question - 408
How to implement a state machine?
[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents
If real-time intersection with line segments in online CAD drawings is realized
Fabric. JS centered element
Pytorch structure reparameterization repvggblock
Current events on July 20
Heavy forecast! Analysys, together with Microsoft and the Central University of Finance and economics, talks about the digital economy
Amd epyc 9654 Genoa CPU cache test exposure L1 bandwidth up to 30tb/s
Cloud native observability tracking technology in the eyes of Baidu engineers
Latex notes
What is the root password of MySQL initial installation