修复 bug

This commit is contained in:
zhbaor 2021-04-24 21:29:32 +08:00
parent 76e807e25e
commit 9c249cd357

11
src/App.vue Executable file → Normal file
View file

@ -59,7 +59,13 @@
</div> </div>
<b-form class="d-flex m-3" @submit.prevent="sendMessage"> <b-form class="d-flex m-3" @submit.prevent="sendMessage">
<b-form-input class="flex-fill mr-2" v-model="message"> </b-form-input> <b-form-input class="flex-fill mr-2" v-model="message"> </b-form-input>
<b-button pill variant="success" type="submit">Button</b-button> <b-button
:disabled="message.length == 0"
pill
variant="success"
type="submit"
>Send</b-button
>
</b-form> </b-form>
</div> </div>
</div> </div>
@ -89,7 +95,7 @@ export default class App extends Vue {
if (chineseChar.test(firstChar)) { if (chineseChar.test(firstChar)) {
return firstChar; return firstChar;
} else { } else {
return this.nickname.substring(0, 2); return nickname.substring(0, 2);
} }
} }
public login(): void { public login(): void {
@ -105,6 +111,7 @@ export default class App extends Vue {
} }
public sendMessage(): void { public sendMessage(): void {
ipcRenderer.send("message", this.message); ipcRenderer.send("message", this.message);
this.message = "";
} }
mounted(): void { mounted(): void {
ipcRenderer.on("message", (_, nickname, message) => { ipcRenderer.on("message", (_, nickname, message) => {