npm

vue-remote-components-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

vue-remote-components-loader

Dynamically load a Vue Component from a URL

Only Support CSR Component

Install

yarn add vue-remote-components-loader

Start

// create
this.$dynamicComponent.create(Component)
// pkg
// umd
"build:module": "vue-cli-service build --target lib src/module.js --name web-invite"
// 导入插件
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)

Package Sidebar

Install

npm i vue-remote-components-loader

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

7.26 kB

Total Files

8

Last publish

Collaborators

  • michael_jier