New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Array subclassing #9259
Labels
Comments
Vue 2 currently does not support Array subclassing (Vue 3 development branch already does). I will convert this into a feature request. |
yyx990803
changed the title
Classes extending Array are converted into Array again
Support Array subclassing
Dec 27, 2018
@AmrIKhudair export function makeReactive (obj) {
// eslint-disable-next-line no-proto
const proto = obj.__proto__
Object.defineProperty(obj, '__proto__', {
get () { return proto },
// eslint-disable-next-line no-proto
set (newValue) { proto.__proto__ = newValue }
})
} import { makeReactive } from 'util'
export default class UserCollection extends Array {
constructor (...args) {
super(...args)
makeReactive(this)
}
} |
@edcoreweb |
warpech
added a commit
to Palindrom/JSONPatcherProxy
that referenced
this issue
Jul 29, 2019
because such problem happens in Vue 2 and it results in an invalid patch. See: vuejs/vue#427, vuejs/vue#9259
Closed
3 tasks
You saved my day in 2022 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
2.5.21
Reproduction link
https://codepen.io/AmrIKhudair/pen/NevxML
Steps to reproduce
1- create a class extending Array and add a custom method
2- instantiate a new instance of the class and add it to data
3- try to call the method on the instance in the template
What is expected?
The method is successfully executed
What is actually happening?
Error not a function
The text was updated successfully, but these errors were encountered: