zoukankan      html  css  js  c++  java
  • vue 源码阅读记录

    0.webpack默认引入的是vue.runtime.common.js,并不是vue.js,功能有略微差别,不影响使用

    1.阅读由ts编译后的js: 入口>构造函数 >定义各类方法 > return vue;

    function Vue (options) {
      if ("development" !== 'production' &&
        !(this instanceof Vue)
      ) {
        warn('Vue is a constructor and should be called with the `new` keyword');
      }
      this._init(options);
    }
    
    initMixin(Vue);
    stateMixin(Vue);
    eventsMixin(Vue);
    lifecycleMixin(Vue);
    renderMixin(Vue);
    

    2.Vue.use() 功能实现

      function initUse(Vue) {
        Vue.use = function (plugin) {
          var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
          if (installedPlugins.indexOf(plugin) > -1) {
            return this
          }
    
          // additional parameters
          var args = toArray(arguments, 1);
          args.unshift(this);
          if (typeof plugin.install === 'function') {
            plugin.install.apply(plugin, args);
          } else if (typeof plugin === 'function') {
            plugin.apply(null, args);
          }
          installedPlugins.push(plugin);
          return this
        };
      }
    

      

    https://www.tongbiao.xyz/
  • 相关阅读:
    安卓输入法
    android问题
    速查
    Iphone幻灯片效果+背景音乐
    MBProgressHUD使用
    画图
    textmate 的快捷键
    设置Table Cell的背景图的类
    Objectc 一些代码规范
    效果收集
  • 原文地址:https://www.cnblogs.com/tongbiao/p/10087871.html
Copyright © 2011-2022 走看看