vue install 组件


import share from './index.vue'

export default {
  install: (Vue) => {
    Vue.prototype.$share = (options) => {
      // 1.创建构造器,定义好提示信息的模板
      const instance = Vue.extend(share);
      // 2.创建实例,挂载到文档以后的地方
      let currentShare = new instance();
      // 3.添加到DOM
      document.body.appendChild(currentShare.$mount().$el);
      // 4.设置属性
      setTimeout(() => (currentShare.show = true), 0);
      // 5.自定义覆盖属性
      Object.assign(currentShare, options);
    }
  }
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM