var newEvent = new CustomEvent("build ", { detail: { dog: "wo", cat: "mio" }, bubbles: true, cancelable: true, composed: true});newEvent.name = "新的事件!";document.addEventListener("build ", function(e) { console.log("你触发了自定义事件!" + newEvent.name) console.log(" event.detail.dog:" + event.detail.dog + "n event.detail.cat:" + event.detail.cat)},false)document.dispatchEvent(newEvent);CustomEvent-MDN



