SOURCE

class Circle {
    draw() {
        console.log("画一个圆");
    }
}
class Decorator {
    constructor(circle) {
        this.circle = circle;
    }
    draw() {
        this.circle.draw();
        this.setRedBorder(circle);
    }
    setRedBorder(circle) {
        console.log("设置红色边框");
    }
}
//测试
let circle = new Circle();
circle.draw();
//画一个圆
let dec = new Decorator(circle);
dec.draw();
//画一个圆
//设置红色边框
console 命令行工具 X clear

                    
>
console