class any{
point(){
console.log(
"i have point"
);
}
}
class Rectangle extends any{
constructor(height, width) {
super
();
this
.height = height;
this
.width = width;
}
get area() {
return
this
.calcArea()
}
calcArea() {
return
this
.height *
this
.width;
}
}
function
copyProperties(target, source) {
const ownPropertyNames = Object.getOwnPropertyNames(source);
ownPropertyNames
.filter(key => !/^(prototype|name|constructor)$/.test(key))
.forEach(key => {
const desc = Object.getOwnPropertyDescriptor(source, key);
console.log(desc);
Object.defineProperty(target, key, desc)
});
}
function
mixin(...mixins) {
class Mix {
}
for
(const mixin of mixins) {
copyProperties(Mix, mixin)
copyProperties(Mix.prototype, mixin.prototype)
}
return
Mix;
}
class Vue extends mixin(Rectangle) {
}
let localVue =
new
Vue(3, 4);
console.dir(localVue.hasOwnProperty(
"height"
));