Vue上面的函數怎麼來的
vue的打包路徑
在web中使用的vue打包路徑: npm run build 打包生成vue.js
下面是依次引入:
src/platforms/web/entry-runtime-with-compiler.js
src/platforms/web/runtime/index.js
src/core/index.js
src/core/instance/index.js
instance/index.js
這個js檔案就是Vue本身了
首先這是一個構造函數, 然後在執行new的時候, 會執行一個this._init函數
導出這個Vue之前,都會挂載一些函數,我們就來看看,分别挂載什麼
import { initMixin } from ‘./init’
import { stateMixin } from ‘./state’
import { renderMinin } from ‘./render’
// $event是指目前觸發的是什麼事件(滑鼠事件,鍵盤事件等) $event.target則指的是事件觸發的目标
import { eventsMixin } from ‘./events’
import { lifecycleMixin } from ‘./lifecycle’
import { warn } from ‘./util/index’