From 2b07ca6064db488271d7cb3fa200de47cc93eedb Mon Sep 17 00:00:00 2001 From: cybermerlin Date: Mon, 3 Dec 2018 18:11:25 +0300 Subject: [PATCH 1/3] fix: Observer> trouble with observe Array (losted special methods) --- src/core/observer/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/observer/index.js b/src/core/observer/index.js index 545adb64025..e66e801a056 100644 --- a/src/core/observer/index.js +++ b/src/core/observer/index.js @@ -46,9 +46,9 @@ export class Observer { def(value, '__ob__', this) if (Array.isArray(value)) { if (hasProto) { - protoAugment(value, arrayMethods) + protoAugment(value, Object.create(value.constructor.prototype)) } else { - copyAugment(value, arrayMethods, arrayKeys) + copyAugment(value, Object.create(value.constructor.prototype), arrayKeys) } this.observeArray(value) } else { From 11e1dd3b7c75e4ea8c883072d8215c3876cd1595 Mon Sep 17 00:00:00 2001 From: cybermerlin Date: Mon, 3 Dec 2018 19:16:24 +0300 Subject: [PATCH 2/3] fix: Observer> observe(Array) --- src/core/observer/array.js | 2 +- src/core/observer/index.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/observer/array.js b/src/core/observer/array.js index 684e37ece58..2f0f712097b 100644 --- a/src/core/observer/array.js +++ b/src/core/observer/array.js @@ -8,7 +8,7 @@ import { def } from '../util/index' const arrayProto = Array.prototype export const arrayMethods = Object.create(arrayProto) -const methodsToPatch = [ +export const methodsToPatch = [ 'push', 'pop', 'shift', diff --git a/src/core/observer/index.js b/src/core/observer/index.js index e66e801a056..84ee5ca605b 100644 --- a/src/core/observer/index.js +++ b/src/core/observer/index.js @@ -2,7 +2,7 @@ import Dep from './dep' import VNode from '../vdom/vnode' -import { arrayMethods } from './array' +import { arrayMethods, methodsToPatch } from './array' import { def, warn, @@ -16,8 +16,6 @@ import { isServerRendering } from '../util/index' -const arrayKeys = Object.getOwnPropertyNames(arrayMethods) - /** * In some cases we may want to disable observation inside a component's * update computation. @@ -45,10 +43,16 @@ export class Observer { this.vmCount = 0 def(value, '__ob__', this) if (Array.isArray(value)) { + + const methods = Object.create(value.constructor.prototype) + methodsToPatch.forEach((m) => { + if (methods[m]) methods[m] = arrayMethods[m] + }) + if (hasProto) { - protoAugment(value, Object.create(value.constructor.prototype)) + protoAugment(value, methods) } else { - copyAugment(value, Object.create(value.constructor.prototype), arrayKeys) + copyAugment(value, methods, Object.getOwnPropertyNames(methods)) } this.observeArray(value) } else { From 35c470099b630f3b49da78c7ab05d179ffb7588c Mon Sep 17 00:00:00 2001 From: cybermerlin Date: Tue, 4 Dec 2018 11:02:26 +0300 Subject: [PATCH 3/3] change README for fork (which I use in my projects) --- README.md | 219 +----------------------------------------------------- 1 file changed, 4 insertions(+), 215 deletions(-) diff --git a/README.md b/README.md index 6d589e4da06..bb8d3b6c3d4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +**This is a fork from the official framework. While they do not approve any PR's then I will develop in this repo and publish to npm with a special name.** + +

Vue logo

@@ -15,215 +18,10 @@ Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/vue/blob/dev/BACKERS.md). If you'd like to join them, please consider: -- [Become a backer or sponsor on Patreon](https://www.patreon.com/evanyou). -- [Become a backer or sponsor on Open Collective](https://opencollective.com/vuejs). -- [One-time donation via PayPal or crypto-currencies.](https://vuejs.org/support-vuejs/#One-time-Donations) - -#### What's the difference between Patreon and OpenCollective? - -Funds donated via Patreon go directly to support Evan You's full-time work on Vue.js. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform. - -

Special Sponsors

- - -

- - - -

- - - -

Platinum Sponsors

- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
- - - -

Platinum Sponsors (China)

- - - - - - - -
- - - - - - - -
- - -

Gold Sponsors

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - -

Sponsors via Open Collective

- -

Platinum

- - - - -

Gold

- - - - - - - ---- ## Introduction -Vue (pronounced `/vjuː/`, like view) is a **progressive framework** for building user interfaces. It is designed from the ground up to be incrementally adoptable, and can easily scale between a library and a framework depending on different use cases. It consists of an approachable core library that focuses on the view layer only, and an ecosystem of supporting libraries that helps you tackle complexity in large Single-Page Applications. +Vue (pronounced `/vjuː/`, like view) is a **framework** for building user interfaces. It is designed from the ground up to be incrementally adoptable, and can easily scale between a library and a framework depending on different use cases. It consists of an approachable core library that focuses on the view layer only, and an ecosystem of supporting libraries that helps you tackle complexity in large Single-Page Applications. #### Browser Compatibility @@ -291,15 +89,6 @@ Detailed changes for each release are documented in the [release notes](https:// - [Blog](https://medium.com/the-vue-point) - [Job Board](https://vuejobs.com/?ref=vuejs) -## Contribution - -Please make sure to read the [Contributing Guide](https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md) before making a pull request. If you have a Vue-related project/component/tool, add it with a pull request to [this curated list](https://github.com/vuejs/awesome-vue)! - -Thank you to all the people who already contributed to Vue! - - - - ## License [MIT](http://opensource.org/licenses/MIT)