MCPcopy
hub / github.com/ygs-code/vue / initGlobalAPI

Function initGlobalAPI

vue.js:7341–7396  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

7339 * 初始化全局api 并且暴露 一些静态方法
7340 */
7341 function initGlobalAPI(Vue) {
7342 // config
7343 var configDef = {};
7344 configDef.get = function () {
7345 return config;
7346 };
7347 {
7348 configDef.set = function () {
7349 warn(
7350 'Do not replace the Vue.config object, set individual fields instead.'
7351 );
7352 };
7353 }
7354 Object.defineProperty(Vue, 'config', configDef);
7355
7356 // exposed util methods.
7357 // NOTE: these are not considered part of the public API - avoid relying on
7358 // them unless you are aware of the risk.
7359 //暴露的util方法。
7360 //注意:这些不是公共API的一部分——避免依赖
7361 //除非你意识到其中的风险。
7362 Vue.util = {
7363 warn: warn, //警告函数
7364 extend: extend, //继承方式
7365 mergeOptions: mergeOptions, //合并参数
7366 defineReactive: defineReactive // 通过defineProperty的set方法去通知notify()订阅者subscribers有新的值修改 添加观察者 get set方法
7367 };
7368
7369 Vue.set = set; //暴露接口静态方法 set
7370 Vue.delete = del; //暴露接口静态方法 delete 方法
7371 Vue.nextTick = nextTick; // 暴露接口静态方法 nextTick 方法
7372
7373 Vue.options = Object.create(null); //创建一个空的参数
7374 // var ASSET_TYPES = [
7375 // 'component', //组建指令
7376 // 'directive', //定义指令 指令
7377 // 'filter' //过滤器指令
7378 // ];
7379 //
7380 //添加components ,directives, filters 指令组件 控对象
7381 ASSET_TYPES.forEach(function (type) {
7382 Vue.options[type + 's'] = Object.create(null);
7383 });
7384
7385 // this is used to identify the "base" constructor to extend all plain-object
7386 // components with in Weex's multi-instance scenarios.
7387 //用来标识扩展所有普通对象的“基”构造函数
7388 // Weex的多实例场景中的组件。
7389 Vue.options._base = Vue;
7390
7391 extend(Vue.options.components, builtInComponents); //合并 KeepAlive参数中的组件对象
7392 initUse(Vue); // 初始化vue 安装插件函数
7393 initMixin$1(Vue); //初始化vue mixin 函数
7394 initExtend(Vue); //初始化 vue extend 函数
7395 initAssetRegisters(Vue); //为vue 添加 静态方法component,directive,,filter
7396 }
7397
7398 //初始化全局api 并且暴露 一些静态方法

Callers 1

vue.jsFile · 0.85

Calls 5

extendFunction · 0.85
initUseFunction · 0.85
initMixin$1Function · 0.85
initExtendFunction · 0.85
initAssetRegistersFunction · 0.85

Tested by

no test coverage detected