8000 props do not need to be in sync mode · mikehins/vue@eabca4d · GitHub
[go: up one dir, main page]

Skip to content

Commit eabca4d

Browse files
committed
props do not need to be in sync mode
1 parent 6f94d2d commit eabca4d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/directives/prop.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ module.exports = {
3030
}
3131
locked = false
3232
}
33-
},
34-
{ sync: true }
33+
}
3534
)
3635

3736
// set the child initial value first, before setting
@@ -54,8 +53,7 @@ module.exports = {
5453
parent.$set(parentKey, val)
5554
locked = false
5655
}
57-
},
58-
{ sync: true }
56+
}
5957
)
6058
}
6159
},

src/watcher.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var uid = 0
1818
* - {Boolean} twoWay
1919
* - {Boolean} deep
2020
* - {Boolean} user
21-
* - {Boolean} sync
2221
* - {Function} [preProcess]
2322
* @constructor
2423
*/
@@ -35,7 +34,6 @@ function Watcher (vm, expOrFn, cb, options) {
3534
this.deep = !!options.deep
3635
this.user = !!options.user
3736
this.twoWay = !!options.twoWay
38-
this.sync = !!options.sync
3937
this.filters = options.filters
4038
this.preProcess = options.preProcess
4139
this.deps = []
@@ -162,7 +160,7 @@ p.afterGet = function () {
162160
*/
163161

164162
p.update = function () {
165-
if (this.sync || !config.async) {
163+
if (!config.async) {
166164
this.run()
167165
} else {
168166
batcher.push(this)

test/unit/specs/instance/scope_spec.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('Instance Scope', function () {
5656
expect(vm.hasOwnProperty('a')).toBe(false)
5757
})
5858

59-
it('replace $data and handle props', function () {
59+
it('replace $data and handle props', function (done) {
6060
var el = document.createElement('div')
6161
var vm = new Vue({
6262
el: el,
@@ -95,15 +95,19 @@ describe('Instance Scope', function () {
9595
b: 3, // one-time
9696
c: 4 // two-way
9797
}
98-
// one-way
9998
expect(child.a).toBe(2)
100-
expect(vm.a).toBe(1)
101-
// one-time
10299
expect(child.b).toBe(3)
103-
expect(vm.b).toBe(2)
104-
// two-way
105100
expect(child.c).toBe(4)
106-
expect(vm.c).toBe(4)
101+
// assert parent state
102+
Vue.nextTick(function () {
103+
// one-way
104+
expect(vm.a).toBe(1)
105+
// one-time
106+
expect(vm.b).toBe(2)
107+
// two-way
108+
expect(vm.c).toBe(4)
109+
done()
110+
})
107111
})
108112

109113
})

0 commit comments

Comments
 (0)
0