finished tutorial
This commit is contained in:
11
notes.md
11
notes.md
@@ -429,6 +429,8 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/imp
|
||||
|
||||
https://vueschool.io/articles/vuejs-tutorials/lazy-loading-and-code-splitting-in-vue-js/
|
||||
|
||||
### Importing js
|
||||
|
||||
In javascript you can use several ways to import modules.
|
||||
|
||||
`import { function } from "module";` is used if you want to import a specific function/class etc from a `.js` file. You can chain the imports with a comma between them. These have to be javascript objects.
|
||||
@@ -443,3 +445,12 @@ component: () =>
|
||||
```
|
||||
|
||||
The difference between `require` and `import`: `import` is better to use as it's a function, whereas `require` is a js library. `require` is synchronous but `import` can be asynchronous, and supports lazy loading.
|
||||
|
||||
### Importing vue components
|
||||
|
||||
When importing other vue components (e.g vue-lottie) any package that says use `npm install --save` can be substituted with `yarn add`. The `--save` just says to add to the `package.json`.
|
||||
|
||||
If importing vue components that have been downloaded into `node_modules`, you can simply import them like any other component. The `.vue` is optional. e.g.
|
||||
|
||||
Installing is done with `yarn add vue-lottie` and importing in another vue component is done with `import Lottie from "vue-lottie"`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user