<!DOCTYPE html>
<html>
<head>
<script src="http://192.168.1.22:8098"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body style="font-size: 30px" id="app">
<section id="no-key-example" class="demo">
<section>
<template v-if="loginType === 'username'">
<label>Username</label>
<input placeholder="Nhập username">
</template>
<template v-else="">
<label>Email</label>
<input placeholder="Nhập email">
</template>
</section>
<button @click="toggleLoginType">Thay đổi kiểu đăng nhập</button>
</section>
<script>
new Vue({
el: '#no-key-example',
data: {
loginType: 'username'
},
methods: {
toggleLoginType: function () {
return this.loginType = this.loginType === 'username' ? 'email' : 'username'
}
}
})
</script>
</body>
</html>