浏览代码

lifecycle: add init hook

Evan You 10 年之前
父节点
当前提交
de6459f8d6
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 3 0
      src/instance/init.js
  2. 1 0
      src/util/options.js

+ 3 - 0
src/instance/init.js

@@ -90,6 +90,9 @@ exports._init = function (options) {
   // it will be filled up in _initScope().
   this._data = {}
 
+  // call init hook
+  this._callHook('init')
+
   // initialize data observation and scope inheritance.
   this._initState()
 

+ 1 - 0
src/util/options.js

@@ -108,6 +108,7 @@ strats.el = function (parentVal, childVal, vm) {
  * Hooks and param attributes are merged as arrays.
  */
 
+strats.init =
 strats.created =
 strats.ready =
 strats.attached =