markdown ES6模块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown ES6模块相关的知识,希望对你有一定的参考价值。

### Default Exports
* Used to export **1 thing**:
  * `export default "blah"`
* In the file you are importing from:
  * `import variabl_name from 'path_of_file'` 

---
### Named Exports
* used to export multiple things
```js
export const add = (a, b) => a + b;
export const multiply = (a, b) => a*b;
export const ID = 23;

// in retrieving file
import {add, mulitply} from './views/searchView';

// you can alias the imported names
import {add as a, mulitply as m} from './views/searchView';

// get everything
import * as searchView from './views/searchView';

```

以上是关于markdown ES6模块的主要内容,如果未能解决你的问题,请参考以下文章

markdown Webpack,es6,postcss

markdown ES6的优点

markdown ES6箭头功能

markdown ES6备忘单

markdown ES6出口/进口备忘单

markdown ES6备忘单