当前位置:网站首页>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 边栏推荐
- Dynamic kubernetes cluster capacity expansion of airbnb
- The leftmost prefix principle of MySQL
- js && ||
- Verification of Kirchhoff's law and Multisim Simulation (engineering documents attached)
- 7.14 - daily question - 408
- UXDB在不知道明文密码的情况下重置密码
- Invitation letter | "people, finance, tax" digital empowerment, vigorously promote retail enterprises to achieve "doubling" of economies of scale
- C recursively obtains all files under the folder and binds them to the treeview control
- ROS机械臂 Movelt 学习笔记3 | kinect360相机(v1)相关配置
- Big talk · book sharing | Haas Internet of things device cloud integrated development framework
猜你喜欢

Amd epyc 9654 Genoa CPU cache test exposure L1 bandwidth up to 30tb/s

Free personal virtual machine - AWS free EC2 package

The first meta universe auction of Chen Danqing's printmaking works will open tomorrow!

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

Pychart exits pytest mode (run pytest in mode)
![[Bert] transformer/bert/attention interview questions and answers](/img/32/5d29ce8056df16211630c3384adcf4.png)
[Bert] transformer/bert/attention interview questions and answers

Young people who lost the IPO

7.14 - daily question - 408

Latex notes

Harbor installation
随机推荐
Codeworks round 650 (Div. 3) ABCD solution
Windows security hardening -- close unnecessary ports
Chapter III kernel development
On let variable promotion
Pursue and kill "wallet Assassin" all over the network
ROS manipulator movelt learning notes 3 | kinect360 camera (V1) related configuration
Unity panel control
Director of Shanghai Bureau of culture and Tourism: safety is the lifeline of culture and tourism, and we are seizing the new track of yuancosmos
C language force buckle the flipped number of question 7. Violence Act
Introduction to thread pool
WhatsApp web for usability testing of software testing technology
Moonpdflib Preview PDF usage record
自动化测试系列-Selenium三种等待详解
Six stones Management: the process is only convenient to shirk responsibility, but not helpful to solve problems
Game partner topic: the cooperation between breederdao and monkeyleague kicked off
paddlepaddle论文系列之Alexnet详解(附源码)
第四章 驱动子系统开发
Related knowledge of paging
Yolov7:oserror: [winerror 1455] the page file is too small to complete the final solution of the operation
Dpdk based basic knowledge sorting-01