Skip to content

Commit 8c86973

Browse files
committed
rename: init -> beforeCreate
1 parent 1b3b194 commit 8c86973

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const config: Config = {
8484
* List of lifecycle hooks.
8585
*/
8686
_lifecycleHooks: [
87-
'init',
87+
'beforeCreate',
8888
'created',
8989
'beforeMount',
9090
'mounted',

src/core/instance/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function initMixin (Vue: Class<Component>) {
3939
vm._self = vm
4040
initLifecycle(vm)
4141
initEvents(vm)
42-
callHook(vm, 'init')
42+
callHook(vm, 'beforeCreate')
4343
initState(vm)
4444
callHook(vm, 'created')
4545
initRender(vm)

test/unit/features/global-api/mixin.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ describe('Global API: mixin', () => {
2222
const calls = []
2323
const Test = Vue.extend({
2424
name: 'test',
25-
init () {
25+
beforeCreate () {
2626
calls.push(this.$options.myOption + ' local')
2727
}
2828
})
2929
Vue.mixin({
30-
init () {
30+
beforeCreate () {
3131
calls.push(this.$options.myOption + ' global')
3232
}
3333
})

test/unit/features/options/lifecycle.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ describe('Options lifecyce hooks', () => {
66
spy = jasmine.createSpy('hook')
77
})
88

9-
describe('init', () => {
9+
describe('beforeCreate', () => {
1010
it('should allow modifying options', () => {
1111
const vm = new Vue({
1212
data: {
1313
a: 1
1414
},
15-
init () {
15+
beforeCreate () {
1616
spy()
1717
expect(this.a).toBeUndefined()
1818
this.$options.computed = {

0 commit comments

Comments
 (0)