function mountCmp (cmp, props, parent) {
    if (cmp.default) {
      cmp = cmp.default
    }
    cmp = Vue.extend(cmp)
    let node = document.createElement('div')
    parent.appendChild(node)
    new cmp({ // eslint-disable-line
      el: node,
      propsData: props,
      parent: this
    })
  }

 

 


      import('../components/title').then(cmp => {
        mountCmp.call(this, cmp, {title: 123456}, document.querySelector('.child-host'))
        mountCmp.call(this, cmp, {title: 123456}, document.querySelector('.child-host'))
      })

 

 

   

 

//title.vue

<template>
    <div class="title">
      <div class="title-icon"></div>
      <div class="title-txt">{{title}}</div>
      <div class="title-dotline">&nbsp;</div>
    </div>
</template>


<script>
export default {
  props: ['title']
}
</script>

 


function mountCmp (cmp, props, parent) {
cmp = Vue.extend(cmp.default)
let node = document.createElement('div')
parent.appendChild(node)
new cmp({ // eslint-disable-line
el: node,
propsData: props,
parent: this
})
}

相关文章:

  • 2021-08-27
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2019-03-19
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-08-29
  • 2021-10-25
  • 2021-07-07
相关资源
相似解决方案