static-vue-loader
static-vue-loader
exposes a VueLoader
method for registering async components. It's useful in static web project to achieve some lazy loading.
VueLoader(option)
option
can be one of:
... components:
or the advanced one:
... components:
Example
Suppose we have a static web project:
ROOT
|- index.html
|- main.js
|- components
|-- my-awesome-component.html
|- lib
|-- jquery.js
|-- vue.js
|-- static-vue-loader.js
index.html
:
... <!-- or add `data-base-url` --> <!-- <script src="./lib/static-vue-loader.js" data-base-url="/public/assets"></script> --> App demo
main.js
:
el: '#app' components: ...
my-awesome-component.html
:
{{msg}} This is a awesome component.
We use http-server ./ -p 4000
to start a static server, and can visit the page at: http://localhost:4000