MCPcopy Index your code
hub / github.com/ygs-code/vue / initUse

Function initUse

vue.js:6959–6980  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

6957 /* */
6958 // 初始化vue 安装插件函数
6959 function initUse(Vue) {
6960 //安装 Vue.js 插件。
6961 Vue.use = function (plugin) {
6962 var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
6963 //
6964 if (installedPlugins.indexOf(plugin) > -1) { //判断是否已经安装过插件了
6965
6966 return this
6967 }
6968
6969 // additional parameters//额外的参数
6970 var args = toArray(arguments, 1); //变成真的数组
6971 args.unshift(this); //在前面添加
6972 if (typeof plugin.install === 'function') { //如果plugin.install 是个函数 则执行安装
6973 plugin.install.apply(plugin, args);
6974 } else if (typeof plugin === 'function') { //如果plugin 是个函数则安装
6975 plugin.apply(null, args);
6976 }
6977 installedPlugins.push(plugin); // 将已经安装过的插件添加到队列去
6978 return this
6979 };
6980 }
6981
6982 /* */
6983 //初始化vue mixin 函数

Callers 1

initGlobalAPIFunction · 0.85

Calls 1

toArrayFunction · 0.85

Tested by

no test coverage detected