You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matrix-chat/src/views/login.vue

74 lines
1.4 KiB
Vue

<template>
<div id="login">
4 years ago
<h1 class="title">open chat</h1>
<div class="input-field" id="longurl">
<label for="longurl-input"></label>
4 years ago
<input v-model="session.content.user" class="input" id="longurl-input" type="text" autocomplete="off" maxlength="20" placeholder="chose nickname">
</div>
4 years ago
<textbtn v-on:click.native="login()" text="login" />
</div>
</template>
<script>
import textbtn from '@/components/textbtn';
4 years ago
import main from "@/main";
export default {
name: "login.vue",
components: {
textbtn
4 years ago
},
4 years ago
methods: {
login() {
if (this.session.content.user !== "") {
this.session.time = Date.now()
main.methods.sendWebSocket(this.session)
}
}
},
4 years ago
data(){
return {
session: {
4 years ago
type: "login",
4 years ago
time: Date.now(),
content: {
user: ""
}
}
}
}
}
</script>
<style scoped>
#login{
4 years ago
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
4 years ago
height: min-content;
width: 100%;
}
input{
padding: 0 2rem 0 2rem;
height: 2.5rem;
color: #fff;
background-color: #1d1d1d;
border-radius: 1.25rem;
border: 1px solid #fff;
text-align: center;
font-size: 1.1rem;
}
input:focus{
color: #000;
background-color: #fff;
}
@media (max-width: 35rem) {
input {
width: calc(100% - 8rem);
}
}
</style>