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