https://github.com/michaelchene/vue-remote-components-loader
Dynamically load a Vue Component from a URL
https://github.com/michaelchene/vue-remote-components-loader
micro-front-end remote-component vue-components
Last synced: 4 months ago
JSON representation
Dynamically load a Vue Component from a URL
- Host: GitHub
- URL: https://github.com/michaelchene/vue-remote-components-loader
- Owner: MichaelChene
- License: mit
- Created: 2021-05-14T01:25:39.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T04:11:11.000Z (about 5 years ago)
- Last Synced: 2025-08-25T14:02:02.017Z (9 months ago)
- Topics: micro-front-end, remote-component, vue-components
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/vue-remote-components-loader
- Size: 99.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-remote-components-loader
Dynamically load a Vue Component from a URL
#### Only Support CSR Component
## Install
```
yarn add vue-remote-components-loader
```
## Start
```javascript
// create
this.$dynamicComponent.create(Component)
// pkg
// umd
"build:module": "vue-cli-service build --target lib src/module.js --name web-invite"
```
```javascript
// 导入插件
import Vue from 'vue'
import loader from 'vue-remote-components-loader'
Vue.use(loader, { router, store })
// * or manual
// import { dynamicComponentState, dynamicComponent } from 'vue-remote-components-loader'
// store.registerModule('dynamicComponentState', dynamicComponentState)
// Vue.prototype.$dynamicComponent = dynamicComponent(store)
const app = new Vue({...})
// use a remote component
app.$moduleLoader({
module1: '//xxx/module1.js'
})
// use local component
import component from './component'
app.$moduleLoader(component)
```