Skip to content

Commit c6961ae

Browse files
author
Evan You
committed
vm.$options
1 parent 85ddd34 commit c6961ae

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function Compiler (vm, options) {
6666
// set inenumerable VM properties
6767
def(vm, '$', makeHash())
6868
def(vm, '$el', el)
69+
def(vm, '$options', options)
6970
def(vm, '$compiler', compiler)
7071

7172
// set parent VM
@@ -252,7 +253,7 @@ CompilerProto.setupObserver = function () {
252253

253254
function registerHook (hook, fn) {
254255
observer.on('hook:' + hook, function () {
255-
fn.call(compiler.vm, options)
256+
fn.call(compiler.vm)
256257
})
257258
}
258259

test/unit/specs/api.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ describe('UNIT: API', function () {
851851
it('should be called before compile', function () {
852852

853853
var called = false,
854-
Test = Vue.extend({ created: function (options) {
855-
assert.ok(options.ok)
854+
Test = Vue.extend({ created: function () {
855+
assert.ok(this.$options.ok)
856856
called = true
857857
}})
858858
new Test({ ok: true })
@@ -864,10 +864,10 @@ describe('UNIT: API', function () {
864864

865865
describe('ready', function () {
866866

867-
it('should be called after compile with options', function () {
867+
it('should be called after compile', function () {
868868
var called = false,
869-
hook = function (options) {
870-
assert.ok(options.ok)
869+
hook = function () {
870+
assert.ok(this.$options.ok)
871871
assert.notOk(this.$compiler.init)
872872
called = true
873873
},

0 commit comments

Comments
 (0)