Commit a4d3cf49 authored by 神楽坂玲奈's avatar 神楽坂玲奈

clean

parent 46ffd581
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<md-icon>vpn_key</md-icon> <md-icon>vpn_key</md-icon>
<span>房间密码</span> <span>房间密码</span>
</md-placeholder> </md-placeholder>
<input #hostPasswordRef mdInput name="title" [(ngModel)]="host_password" readonly> <input #hostPasswordInput mdInput name="title" [(ngModel)]="host_password" readonly>
<button type="button" md-icon-button mdSuffix (click)="copy(host_password)"> <button type="button" md-icon-button mdSuffix (click)="copy(host_password)">
<md-icon>content_copy</md-icon> <md-icon>content_copy</md-icon>
</button> </button>
......
...@@ -14,8 +14,8 @@ import { YGOProService } from '../ygopro.service'; ...@@ -14,8 +14,8 @@ import { YGOProService } from '../ygopro.service';
}) })
export class NewRoomComponent { export class NewRoomComponent {
@ViewChild('hostPasswordRef') @ViewChild('hostPasswordInput')
hostPasswordRef: ElementRef; hostPasswordInput: ElementRef;
host_password = (this.login.user.external_id ^ 0x54321).toString(); host_password = (this.login.user.external_id ^ 0x54321).toString();
...@@ -31,7 +31,7 @@ export class NewRoomComponent { ...@@ -31,7 +31,7 @@ export class NewRoomComponent {
copy(host_password: string) { copy(host_password: string) {
try { try {
this.hostPasswordRef.nativeElement.select(); this.hostPasswordInput.nativeElement.select();
if (document.execCommand('copy')) { if (document.execCommand('copy')) {
this.snackBar.open(`房间密码 ${host_password} 已复制到剪贴板`, undefined, { duration: 3000 }); this.snackBar.open(`房间密码 ${host_password} 已复制到剪贴板`, undefined, { duration: 3000 });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment