当前位置:网站首页>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 边栏推荐
- Some of my understanding about anti shake and throttling
- Latest information of 2022 cloud computing skills competition
- The use of Multimeter in circuit analysis experiment of Shandong University
- Educational events
- Heavy forecast! Analysys, together with Microsoft and the Central University of Finance and economics, talks about the digital economy
- Install scoop and lux (formerly Annie)
- ===、==、Object. Is basic package type
- [icore4 dual core core _arm] routine 22: LwIP_ UDP experiment Ethernet data transmission
- 自动化测试系列-Selenium三种等待详解
- ROS manipulator movelt learning notes 3 | kinect360 camera (V1) related configuration
猜你喜欢

Unity slider slider development

mysql初次安装的root密码是什么

Notes on topic brushing (XXII) -- Dynamic Planning: basic ideas and topics

7.24 party notice

Summary of MATLAB basic grammar

Join MotoGP Monster Energy British Grand Prix!

Esp32 OLED lvgl displays common Chinese characters
![Yolov7:oserror: [winerror 1455] the page file is too small to complete the final solution of the operation](/img/e1/51f750d355b248ab84e10f0e134271.png)
Yolov7:oserror: [winerror 1455] the page file is too small to complete the final solution of the operation

MySQL series | log module

Moonpdflib Preview PDF usage record
随机推荐
Young people who lost the IPO
Educational events
===、==、Object. Is basic package type
Password input box and coupon and custom soft keyboard
第三章 内核开发
Implementing DDD based on ABP -- domain logic and application logic
Detailed usage of iperf
Redis pipeline technology / partition
The troubleshooting process of a segment error (disassembly address troubleshooting)
How to implement a state machine?
Which bank outlet in Zhejiang can buy REITs fund products?
Find the median of two numbers in the fourth question of C language deduction (three methods)
第四章 驱动子系统开发
Redis transaction learning
Research and Multisim Simulation of linear circuit characteristics (engineering documents attached)
MySQL的最左前缀原则
Some of my understanding about anti shake and throttling
Six stones Management: the process is only convenient to shirk responsibility, but not helpful to solve problems
进程的几种状态
Notes on topic brushing (XXII) -- Dynamic Planning: basic ideas and topics