import subject from "nxjs/subject"; let sub = new subject(); //发布订阅 sub.subscribe(data=>{ console.log(data> }); //执行订阅的事件 sub.next(data);