The first knowledge point: import and export

// Import All
import people from './example'

// There is a special situation that allows you to the entire module as a single object import
// export all of the module will continue to exist as a property of the object
Import AS * Example from "./example.js"
console.log (Example. name)
console.log (example.age)
console.log (example.getName ())

// Import part
import {name, age} from ' ./example'

 

 

// Export default, and only one default
export default App

// portion derived
export class App extend Component {};

1. When using export default people export, import import people to use (without braces)

2. a file, there is one and only one export default. There can be multiple export.

3. When using export name, to use import {name} import (remember to bring braces)

4. When a file, both an export default people, there are a plurality of export name or export age, introducing it with the import people, {name, age}

5. When a plurality of n export file appears many modules export, in addition to introducing a an import, use may import * as example

Guess you like

Origin www.cnblogs.com/chenjacky/p/11368737.html