当前位置:网站首页>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 边栏推荐
- What are the functions of rank function
- 494. Target sum · depth first search · knapsack problem
- Pychart exits pytest mode (run pytest in mode)
- The font changes with the change of the form
- Solution to the shortest Hamilton path problem
- The first meta universe auction of Chen Danqing's printmaking works will open tomorrow!
- MySQL series | log module
- Daily question 1 · 1260. Two dimensional network migration · simulation
- Latex notes
- BGP machine room and BGP
猜你喜欢

7.24 party notice

Breederdao's first proposal was released: the constitution of the Dao organization

How to empty localstorage before closing a page

Latest information of 2022 cloud computing skills competition

Listing of China graphite: the market value is nearly HK $1.2 billion, achieving a zero breakthrough in the listing of Hegang private enterprises

C # "learning code snippet" - recursively obtain all files under the folder
![[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents](/img/97/c4ef281ca14eb68c8a14f18e03c3dd.png)
[development tutorial 10] crazy shell · open source Bluetooth smart health watch OTA image production and download technical documents
![[Bert] transformer/bert/attention interview questions and answers](/img/32/5d29ce8056df16211630c3384adcf4.png)
[Bert] transformer/bert/attention interview questions and answers

Cloud native observability tracking technology in the eyes of Baidu engineers

js && ||
随机推荐
[icore4 dual core core _arm] routine 22: LwIP_ UDP experiment Ethernet data transmission
If in ython__ name__ == ‘__ main__‘: Function and principle of
unresolved external symbol [email protected] resolvent
After burning up 130 billion yuan in ten years, vertical e-commerce will eventually enter the dust of history
#648 (Div. 2)(A. Matrix Game、B. Trouble Sort、C. Rotation Matching)
494. Target sum · depth first search · knapsack problem
ASP rs.open SQL, Conn, what does 3, 1 stand for in 3,1?
Number of palindromes in question 5 of C language deduction (two methods)
Call camera photo album / upload / scan code in uniapp
Some of my understanding about anti shake and throttling
WhatsApp web for usability testing of software testing technology
Mobile terminal touch event
7.14 - daily question - 408
Uxdb resets the password without knowing the plaintext password
The number of palindromes in question 9 of C language deduction. Two pointer array traversal method
[Bert] QA, reading comprehension, information retrieval
Which bank outlet in Zhejiang can buy REITs fund products?
How to better use the touchpad of notebook
MySQL Basics (concepts, common instructions)
ROS机械臂 Movelt 学习笔记3 | kinect360相机(v1)相关配置