Просмотр исходного кода

fix setting get-only property error in phantomjs

Evan You 12 лет назад
Родитель
Сommit
1c5f1d3e21
2 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      src/instance/scope.js
  2. 0 0
      test/unit/scope_spec.js

+ 6 - 1
src/instance/scope.js

@@ -116,13 +116,18 @@ exports._initData = function (data, init) {
  * Setup computed properties.
  */
 
+function noop () {}
+
 exports._initComputed = function () {
   var computed = this.$options.computed
   if (computed) {
     for (var key in computed) {
       var def = computed[key]
       if (typeof def === 'function') {
-        def = { get: def }
+        def = {
+          get: def,
+          set: noop
+        }
       }
       def.enumerable = true
       def.configurable = true

+ 0 - 0
test/unit/data_spec.js → test/unit/scope_spec.js