<div id="no-key-example" class="demo">
<div>
<template v-if="loginType === 'username'">
<label>Username</label>
<input placeholder="Enter your username">
</template>
<template v-else>
<label>Email</label>
<input placeholder="Enter your email address">
</template>
</div>
<button @click="toggleLoginType">Toggle login type</button>
</div>
new Vue({
el: '#no-key-example',
data: {
loginType: 'username'
},
methods: {
toggleLoginType: function () {
return this.loginType = this.loginType === 'username' ? 'email' : 'username'
}
}
})
This Pen doesn't use any external CSS resources.