手动初始化
This commit is contained in:
parent
c942b7673a
commit
09dc671216
@ -188,6 +188,7 @@ const handleReceive = async () => {
|
||||
};
|
||||
// 事件监听
|
||||
onMounted(() => {
|
||||
peer.init();
|
||||
peer.on("open", ((event: CustomEvent) => {
|
||||
myId.value = event.detail;
|
||||
const sign = getUrlParam("sign");
|
||||
|
@ -21,7 +21,9 @@ class Peer extends EventTarget {
|
||||
constructor(sign: string) {
|
||||
super()
|
||||
this.sign = sign
|
||||
this.peer = new PeerJs(sign2peerid(sign))
|
||||
}
|
||||
public init() {
|
||||
this.peer = new PeerJs(sign2peerid(this.sign))
|
||||
this.peer.on('open', (id) => {
|
||||
console.log('peer open', id)
|
||||
this.id = id
|
||||
|
Loading…
Reference in New Issue
Block a user