es6导入导出
导出模块
//可以将export 放在任何变量 函数或类声明的前面
export let firstName='Abc'
//也可以使用大括号指定所要输出的一组变量
let firstName='Abc'
let lastName='Sun'
export { firstName,lastName}
//使用export default时 对应的import语句不需要使用大括号
let bosh=function crs(){}
export default bosh
import crc from '导出的文件'
//不使用export default时 对应的import语句需要使用大括号
let bosh=function crs(){}
export bosh
import {bosh} from '导出的文件'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//在js文件中导入所有vue文件重命名并导出
export { default as Navbar } from './Navbar'
export { default as Sidebar } from './Sidebar'
export { default as AppMain } from './AppMain'
//在外层组件内使用 导入
import { Navbar, Sidebar, AppMain } from './components'
1
2
3
4
5
6
导入模块
————————————————
版权声明:本文为CSDN博主「沉迷...」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_42343307/article/details/120069896